react-native-template-typescript: Property body[6] of BlockStatement expected node to be of a type ["Statement"] but instead got "AssignmentExpression"
Expected results
Run react native template
Observed results
Cannot run blank application created just after created it (npx react-native init MyApp --template react-native-template-typescript
).
Logs
> react-native start
#######
################
######### #########
######### ##########
######### ###### #########
##########################################
##### ##################### #####
##### ############## #####
##### ### ###### ### #####
##### ####### ####### #####
##### ########### ########### #####
##### ########################## #####
##### ########################## #####
##### ###################### ######
###### ############# #######
######### #### #########
######### #########
######### #########
#########
Welcome to Metro!
Fast - Scalable - Integrated
To reload the app press "r"
To open developer menu press "d"
BUNDLE ./index.js
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"
BUNDLE ./index.js
error: node_modules/react-native/Libraries/Components/ScrollView/ScrollViewContext.js: Property body[6] of BlockStatement expected node to be of a type ["Statement"] but instead got "AssignmentExpression"
BUNDLE ./index.js
error: node_modules/react-native/Libraries/Components/ScrollView/ScrollViewContext.js: Property body[6] of BlockStatement expected node to be of a type ["Statement"] but instead got "AssignmentExpression"
BUNDLE ./index.js
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"
info Opening developer menu...
BUNDLE ./index.js
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"
Steps to reproduce
- Initialise repository
- Try to runnit
OS: macOS 11.4 Hardware MacBook Pro 15-inch, 2019 (2.3 GHz 8-Core Intel Core i9, 32 GB 2400 MHz DDR4, Radeon Pro Vega 20) Xcode: Version 12.5.1 (12E507) NodeJS: v14.17.0
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 18
- Comments: 18 (1 by maintainers)
I found a solution.
Download @babel from here: https://drive.google.com/file/d/1-z_4H_z4x075unZqZD41WYUwY_hsrKox/view
And replace the @babel folder in node_modules
Same issue on MacBook Pro (15-inch, 2018) Processor Name: 6-Core Intel Core i7 Processor Speed: 2.2 GHz Running on macOS Big Sur
XCode - Version 12.5.1 (12E507) Node - v14.15.0
Tried to do basic installation stated at https://reactnative.dev/docs/environment-setup
Steps to Reproduce
Step 1: npm install -g expo-cli
Step 2: expo init AwesomeProject
Step 4: cd into the folder
Step 5: expo start
Step 6: Select iOS Simulator on the Browser
In the terminal, getting the following error -
This is the screenshot in the Expo Go App on the Simulator
You need to add babel “resolutions” to your package.json file
Example:
Guys! I would recommend to not download any modules outside npm! This bug should be fixed already according to other issues. I’ll check more later today. Probably it was babel issue.
Try this solution , works for me!
hi guys, same problem I had this problem while building App. I can’t figure out how to fix it, can someone here help me?
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”
I def solved this by doing the following steps:
^
from babel packagesthanks @gabacode for the help on this!
It occurs due to a babel update: https://github.com/facebook/react-native/issues/31961