ReactNative 更新版本步骤

以更新项目react-native0.56.0更新为react-native0.55.4版本为例

1 通过指令

进入项目目录,依次输入下列指令:


  
  
  1. react-native run-android
  2. //卸载react-native
  3. npm uninstall react- native
  4. //安装 0.55 .4版本的react- native
  5. npm install --save [email protected]
  6. react- native run-android
  7. npm install --save babel-core@latest babel-loader@latest
  8. npm uninstall --save babel-preset-react-native
  9. npm install --save [email protected]
  10. react- native run-android

2 通过修改package.json

打开项目目录中的package.json文件,

1 dependencies修改为:


  
  
  1. "dependencies": {
  2. "babel-core": "^6.26.3",
  3. "babel-loader": "^7.1.5",
  4. "babel-preset-react-native": "^4.0.0",
  5. "react": "16.4.1",
  6. "react-native": "^0.55.4"
  7. },

2 devDependencies修改:

删除 "babel-preset-react-native": "5.0.2",

3. 然后执行:npm install

文件对比:

以更新项目react-native0.56.0更新为react-native0.55.4版本为例

猜你喜欢

转载自blog.csdn.net/qq_21937107/article/details/84872953