錯誤環境
新版本存在不兼容,在運行 react-native run-android
[備注:紅色的字體是小寫的哦] 的時候,發生的錯誤分析:
$ react-native -v:
react-native-cli: 2.0.1react-native: 0.47.1
$node -v :
v7.8.0
$ npm -v:
4.4.4
babel-preset-react-native version : @3.0.0 存在問題,需要版本回退
解決方案
方案1:使用 yarn 工具
$ yarn remove babel-preset-react-native
$ yarn add babel-preset-react-native@2.1.0
重啟一下
方案2:使用 npm 工具
$ npm uninstall --save-dev babel-preset-react-native
$ npm install babel-preset-react-native@2.1.0
重啟一下
參考
https://github.com/facebook/react-native/issues/15513
https://github.com/facebook/react-native/issues/15545
總結
在發布新包的時候,需要進行嚴格測試,否則可能會造成大量用戶的終端出現問題,從而導致在github上開issue的沖動 …