ReactNative--TypeError: Cannot read property 'throwIfClosureRequired' of undefined

    今天在react-native init 新建项目时,发现react native的版本从0.55.2升级到了0.55.3,初始化项目之后在安卓上运行时,node服务器编译错误,报错如下:

error: bundling failed: TypeError: Cannot read property 'throwIfClosureRequired' of undefined (While processing preset: "F:\\ReactNative\\NewsApp\\node_modules\\babel-preset-react-native\\index.js")

    显示是babel-preset-react-native的问题,我对比之前的项目发现在0.55.2中使用的babel-preset-react-native版本是4.0.0,而在0.55.3中的babel-preset-react-native是5.0.0,导致报错。

    解决方法就是将babel-preset-react-native降会原来的4.0版本。在项目目录下执行:

npm uninstall --save-dev babel-preset-react-native
npm install [email protected]

你可能感兴趣的:(WEB)