小白尝新,第一次运行RN导出的源码,app.gradle中报错,异常显示找不到这两个文件, 作为第一次运行RN编译代码的菜鸡,没做任何预先了解, 看到这个错,第一时间是删代码, 结果是gg的(windows端)
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
复制代码
解决方法:
1.配置环境
a.安装python2 https://www.python.org/downloads/
b.安装node.js http://nodejs.cn/download/
c.安装Yarn https://yarnpkg.com/zh-Hans/docs/install
安装好yarn之后要添加注册表, 网上找的别人的轮子 命令行复制粘贴,回车
yarn config set registry https://registry.npm.taobao.org --global
yarn config set disturl https://npm.taobao.org/dist --global
复制代码
安装完上述的工具之后, 进入命令行 运行以下指令
npm install -g yarn react-native-cli
2.初始化存在的项目
这时基本环境已经构建完成, 需要到原始RN 项目的目录中执行以下命令(命令行),依次执行
npm init
npm install –save react react-native //安装React 和React Native 到项目中
react-native curl -o .flowconfig
复制代码
如果出现 react-native 不是内部外部命令, 继续执行 npm install -g yarn react-native-cli
可能会用到的三个博客
https://www.jianshu.com/p/e6a081bb271c
https://juejin.im/entry/58e7431eda2f60005ff3cbcf
https://blog.csdn.net/u013531824/article/details/50766533
复制代码