chocolatey安装
直接在命令行执行iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex会说iwr不能执行,解决方案如下
1.
需要以管理员权限打开命令提示符窗口,然后输入以下命令即可:
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
2.
打开管理员权限的Powershell,然后输入以下命令:
iex ((new-objectnet.webclient).DownloadString('https://chocolatey.org/install.ps1'))
安装nodejs和python2(python2需要科学上网工具)
choco install nodejs.install
choco install python2
npm install -g react-native-cli
react-native init AwesomeProject
cd AwesomeProject
react-native start(执行此命令时出现Command `start` unrecognized. Make sure that you have run `npm install` and that
you are inside a react-native project.是因为react-native init AwesomeProject未能执行成功需要执行以下三个命令
1.npm config set registry https://registry.npm.taobao.org
2.npm config set disturl https://npm.taobao.org/dist
3.react-native init AwesomeProject
)
补:
将react native加入已存在的工程
curl -o .flowconfig https://raw.githubusercontent.com/facebook/react-native/master/.flowconfig
命令行报错curl不是内部或外部命令,因为地址是https的,所以需要去下载一个包含ssl的curl软件,软件下载地址:https://curl.haxx.se/download.html 下载之后解压,将curl.exe(没有exe文件是因为下错了)文件放到C:\windows\system32下,然后重新执行就可以了
参考文章:
1.https://facebook.github.io/react-native/docs/getting-started.html#content
2.http://blog.csdn.net/u011054333/article/details/51484943
3.http://blog.csdn.net/shakdy/article/details/54583774
补-参考博客:
http://www.cnblogs.com/xing901022/p/4652624.html
http://blog.csdn.net/u010909423/article/details/50602427