1、首先按照这个文档里的步骤 https://reactnative.cn/docs/0.51/upgrading.html
npm install -g react-native-git-upgrade
我执行到一半给关了,再次执行的时候出错
ERR! Unexpected end of JSON input while parsing near '...nd-index-1.0.2
这个错
然后执行
npm cache clean --force
清空缓存,就可以重新下载了
2、继续按官方文档走 在项目根目录里执行
react-native-git-upgrade
出现错误
react-native version in "package.json" (0.35.0) doesn't match the installed version in "node_modules" (0.39.2).
按照出现的错误信息推荐的方法,执行 npm install
3、执行到一半又出现了
Maximum call stack size exceeded
解决方法:给npm升级或者降级
降级 : npm install -g [email protected]
升级 : npm install -g npm 升级到最新版
我的是降级搞定的;
4、继续执行 react-native-git-upgrade
还是出问题了
npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npmgit-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: Command 'npm install --save --color=always [email protected] react@^16.3.0-alpha.1' exited with code 1:
于是换成手动升级
执行 npm install --save react-native@0.54.2 接着就OK了