对于刚接触RN的小白来说,运行个项目太难了,一步一个坑。
- 环境搭建
按照官网的来就可以,非常详细 ,附上链接:https://reactnative.cn/docs/getting-started.html
- 创建项目运行问题报错信息: Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
- 'react-native' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
解决方案参考:https://blog.csdn.net/niuba123456/article/details/81879747
3.Exception in thread "main" java.net.SocketException: Unexpected end of file from server
4.导入React Native项目报错
可能原因:1、检查项目是否有node_modules 文件夹
2、检查插件是否安装,未安装可使用 命令,到项目根目录下执行
npm install --save react-scripts
5.error for @react-native-community/cookies@3.0.0 No matching version found for @react-native-community/cookies@3.0.0.
解决方案:请参考这个。(解决了我的问题)
6.npm ERR! code 128
npm ERR! Command failed: git clone --mirror -q git://github.com/mattermost/mattermost-utilities.git C:\Users\admin\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-05abea03\.git --config core.longpaths=true
npm ERR! warning: templates not found in C:\Users\admin\AppData\Local\Temp\pacote-git-template-tmp\git-clone-598c49e6
npm ERR! fatal: read error: Invalid argument
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\admin\AppData\Roaming\npm-cache\_logs\2020-06-28T07_27_19_218Z-debug.log
解决办法:命令行输入git config --global http.sslverify "false" 回车,然后再执行npm install
未完待续、、、