babel: React Native - TypeError: Cannot read property 'bindings' of null at Scope.moveBindingTo
Hello,
I have babel in my node_modules and when i do react-native run-android I have an error :
error: bundling failed: TypeError: Cannot read property ‘bindings’ of null at Scope.moveBindingTo (/Users/Theo/Documents/React Native/HuberApp/node_modules/@babel/traverse/lib/scope/index.js:978:13) at BlockScoping.updateScopeInfo (/Users/Theo/Documents/React Native/HuberApp/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:364:17) at BlockScoping.run (/Users/Theo/Documents/React Native/HuberApp/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:330:12) at PluginPass.BlockStatementSwitchStatementProgram (/Users/Theo/Documents/React Native/HuberApp/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:70:24) at newFn (/Users/Theo/Documents/React Native/HuberApp/node_modules/@babel/traverse/lib/visitors.js:237:21) at NodePath._call (/Users/Theo/Documents/React Native/HuberApp/node_modules/@babel/traverse/lib/path/context.js:65:20) at NodePath.call (/Users/Theo/Documents/React Native/HuberApp/node_modules/@babel/traverse/lib/path/context.js:40:17) at NodePath.visit (/Users/Theo/Documents/React Native/HuberApp/node_modules/@babel/traverse/lib/path/context.js💯12) at TraversalContext.visitQueue (/Users/Theo/Documents/React Native/HuberApp/node_modules/@babel/traverse/lib/context.js:142:16) BUNDLE [android, dev] …/…/index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.
Can you help me please ?
Here is my package.json
"devDependencies": { "@babel/preset-env": "^2.0.0-alpha.20", "babel-jest": "22.4.3", "babel-preset-react-native": "^5", "jest": "22.4.3", "react-test-renderer": "16.3.1"
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 22
- Comments: 35 (14 by maintainers)
please use version 5.0.2 of babel-preset-react-native, it will work. Its because of old version of it.I had faced it before,
I’m closing this issue since it was a configuration problem. If someone else has the same problem, please install the last version of every package.
I’m getting “.overrides is not allowed in preset options” as well. Did you fix it @to175?
I’m just adding to this issue as I spent the whole day with the same problem. If you’re using webpack, check that your babel-loader is > version 8 and that the plugins reference the new @babel ones.
Also, if you’re RN 0.56.0, you should be importing all @babel plugins @7.0.0-beta.47 and babel-preset-react-native @5.0.2, not metro-react-native-babel-preset. Check the RN changelog for peace of mind https://github.com/react-native-community/react-native-releases/blob/master/CHANGELOG.md#056
Could you also try to use
metro-react-native-babel-preset
(you need to use themodule:
prefix in your config)? It seems that React Native uses that one now (https://github.com/facebook/react-native/issues/20327)Why do you still have
babel-preset-react-native
? 🤔 (Also,metro-react-native-babel-preset
should probably be in yourdevDependencies
). Does your error still mention babel-plugin-transform-es2015-block-scoping?I think that this could work:
If it doesn’t, run
npx nls why babel-plugin-transform-es2015-block-scoping
to see what is pulilng in Babel 6 modules.I’m with the same problem… For me works downgrade the RN version to 0.55.4 and babel-preset-react-native version to 4.0.1
if you wanna try: npm install react-native@0.55.4 --save && npm install babel-preset-react-native@4.0.1 --save
Past your
package-lock.json
/yarn.lock
contents at https://gist.github.com/ and share the linkWhat does
npx nls why babel-plugin-transform-es2015-block-scoping
print?What is in your Babel configuration? Also
"@babel/preset-env": "^2.0.0-alpha.20"
is not an existing version. Perhaps that is a mistake?