Neil Alden Escobin
Neil Alden Escobin

Reputation: 3

react-native android won't run on device

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

Answers (3)

Emmanuel Oreoluwa
Emmanuel Oreoluwa

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

Run this command:
npm install --save-dev @babel/plugin-transform-react-display-name

Upvotes: 0

Daniel Sá
Daniel Sá

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

Related Questions