Reputation: 3
i just started a project and im trying to start the but it already has this error showing:
error: node_modules\react-native\Libraries\Image\ImageAnalyticsTagContext.js: Property body[6] of BlockStatement expected node to be of a type ["Statement"] but instead got "AssignmentExpression"
Upvotes: 0
Views: 571
Reputation: 81
The problem is due to a babel update that affected the RN project. copy @babel from some other project and paste in node_modules or Download the @babel folder from here and replace the existing folder in the node_modules.@Babel Download
And run
npm start --reset-cache
Upvotes: 0
Reputation: 1
Run this command:
npm install --save-dev @babel/plugin-transform-react-display-name
Upvotes: 0
Reputation: 181
this is a known issue caused by a bug in a newly released version of babel. it will impact all new react-native and expo apps. you can resolve it with yarn resolutions in a new project:
--- a/package.json
+++ b/package.json
@@ -25,5 +25,8 @@
},
"jest": {
"preset": "react-native"
+ },
+ "resolutions": {
+ "@babel/plugin-transform-react-display-name": "7.14.5"
}
}
After insert resulutions key on the package.json, run yarn install
Credits: https://github.com/brentvatne
Issue Link: https://github.com/facebook/react-native/issues/31961
Upvotes: 1