React-Native 安装使用

来源:互联网 发布:没有网站怎么做seo 编辑:程序博客网 时间:2024/09/21 08:48

React-Native 安装使用

1、首先

运行 cmd +r ,输入:

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

2、安装 python2

choco install python2

3、安装 nodeJS

choco install nodejs.install

4、安装完node后建议设置npm镜像以加速后面的过程(或使用科学上网工具)。

npm config set registry https://registry.npm.taobao.org --globalnpm config set disturl https://npm.taobao.org/dist --global

5、开始安装 react_Native 的基础插件react-native-cli

npm install -g yarn react-native-cli

完成之后,就可以使用 react-native-cli 安装你所需的项目了

6、切换到你想存放项目的指定路劲地址,然后执行命令:

react-native init AwesomeProjectcd AwesomeProjectreact-native run-android

7、当你安装完成之后,在cmd切换到你项目目录地址,

运行命令:

npm start //开启服务,默认端口为:8081

注:

当你运行的时候,可能会因为电脑的某些配置,会占用端口号,报403错误信息,例如:

这里写图片描述


解决方案在这里:

解决1

如果解决1还是没解决你的问题,那么请看:

解决2


0 0