我正在尝试使用以下命令在我的AVD上运行react native应用程序:
react-native run-android
但出现以下错误:
bundling failed: Error: Plugin 0 specified in "C:\\Users\\ASUS\\test\\node_modules\\babel-preset-react-native\\index.js" provided an invalid property of "default" (While processing preset: "C:\\Users\\ASUS\\test\\node_modules\\babel-preset-react-native\\index.js") at Plugin.init (C:\Users\ASUS\test\node_modules\babel-core\lib\transformation\plugin.js:131:13) at Function.normalisePlugin (C:\Users\ASUS\test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:152:12) at C:\Users\ASUS\test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:184:30 at Array.map (<anonymous>) at Function.normalisePlugins (C:\Users\ASUS\test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:158:20) at OptionManager.mergeOptions (C:\Users\ASUS\test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:234:36) at C:\Users\ASUS\test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:265:14 at C:\Users\ASUS\test\node_modules\babel-core\lib\transformation\file\options\option-manager.js:323:22 at Array.map (<anonymous>)
.babelrc:
{ "presets": [ "react-native" "@babel/preset-flow" ] }
package.json:
{ "name": "test", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest" }, "dependencies": { "react": "16.4.1", "react-native": "^0.55.4" }, "devDependencies": { "babel-jest": "23.4.0", "babel-preset-react-native": "5.0.2", "jest": "23.4.1", "react-test-renderer": "16.4.1" }, "jest": { "preset": "react-native" } }
我正在使用Windows,node.js v 8.11.3&react native v 0.55.4
我已经尝试了互联网上推荐的所有东西(特别是github),但还是没有运气。如果有人可以提供帮助,我们深表感谢。
这是错误 babel-preset-react-native
babel-preset-react-native
设置版本:
yarn remove babel-preset-react-native yarn add babel-preset-react-native@2.1.0