When I created a new project in react-native init today, I found that the version of react native has been upgraded from 0.55.2 to 0.55.3. After initializing the project and running it on Android, the node server compiles an error, and the error is as follows:
error: bundling failed: TypeError: Cannot read property 'throwIfClosureRequired' of undefined (While processing preset: "F:\\ReactNative\\NewsApp\\node_modules\\babel-preset-react-native\\index.js")
The display is a problem of babel-preset-react-native. I compared the previous project and found that the version of babel-preset-react-native used in 0.55.2 is 4.0.0, while the babel-preset-react in 0.55.3 -native is 5.0.0, resulting in an error.
The solution is to downgrade babel-preset-react-native to the original 4.0 version. Execute in the project directory:
npm uninstall --save-dev babel-preset-react-native npm install [email protected]