React-native: react native init "index.js: "" is not a valid identifer name" with latest RN Version

Created on 5 Nov 2019  路  22Comments  路  Source: facebook/react-native

Simulator Screen Shot - iPhone 11 - 2019-11-05 at 15 06 45

React Native version:
System:
OS: macOS Mojave 10.14.6
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Memory: 737.31 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.15.3 - /usr/local/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.12.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5692245
Xcode: 11.0/11A420a - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.3 => 0.61.3
npmGlobalPackages:
react-native-asset: 2.0.0
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
react-native: 0.59.8

Steps To Reproduce

  1. react-native init example
  2. cd example
  3. react-native run-ios

Describe what you expected to happen:

It simply not working at all. This issue just appears after RN 0.61.4. It would work with RN 0.61.3 however now it is not working with RN 0.61.3 with this new react-native init command.

Bug

Most helpful comment

I'm a starter in RN and this is killing me. I started learning it 3 days ago. It was running all good but suddenly this started when I created a new project.

Believe me, I understand you :) Please do not give up the React Native. It is awesome and its community is also awesome. I'm sure that, this will be covered ASAP

All 22 comments

This error started happening when I upgraded from Babel 7.6.4 to 7.7.0.
I've reverted the upgrade and it's back to normal FYI

I'm a starter in RN and this is killing me. I started learning it 3 days ago. It was running all good but suddenly this started when I created a new project.

This error started happening when I upgraded from Babel 7.6.4 to 7.7.0.
I've reverted the upgrade and it's back to normal FYI

I'm gonna try it very fast :)

Edit: Unfortunately, downgrading from scratch project did not work :(

This error started happening when I upgraded from Babel 7.6.4 to 7.7.0.
I've reverted the upgrade and it's back to normal FYI

I'm gonna try it very fast :)

I tried and it's still the same:
Screenshot 2019-11-05 at 5 59 42 PM

I'm a starter in RN and this is killing me. I started learning it 3 days ago. It was running all good but suddenly this started when I created a new project.

Believe me, I understand you :) Please do not give up the React Native. It is awesome and its community is also awesome. I'm sure that, this will be covered ASAP

I also have this issue, just attempted to create a project, same error.

Try downgrading @babel/core to 7.64 and @babel/runtime to 7.6.3 and restart metro react-native-start

I'm a starter in RN and this is killing me. I started learning it 3 days ago. It was running all good but suddenly this started when I created a new project.

Believe me, I understand you :) Please do not give up the React Native. It is awesome and its community is also awesome. I'm sure that, this will be covered ASAP

Thanks for that 馃憤 But how this thread goes is going to decide if I stay here or flutter away. :(

Try downgrading @babel/core to 7.64 and @babel/runtime to 7.6.3 and restart metro react-native-start

still the same error

Same error for me using 7.6.0:

"dependencies": {
"react": "16.9.0",
"react-native": "0.60.5"
},
"devDependencies": {
"@babel/core": "7.6.0",
"@babel/runtime": "7.6.0",
"@babel/types":"7.6.0",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.6.0",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.57.0",
"react-test-renderer": "16.9.0"
},

The error refers to: TypeError: "" is not a valid identifer name ... node_modules\@babeltypeslibdefinitionscore.js

I've tried a fresh install of:

  1. Expo js & ts
  2. RN js & ts

Try downgrading @babel/core to 7.64 and @babel/runtime to 7.6.3 and restart metro react-native-start

Not working 馃様

I can't reproduce the error anymore, but it first happened like so:

  1. Noticed babel and babel runtime outdated
  2. Did a yarn upgrade
  3. Close the metro terminal and react-native run-ios
  4. The error above happened.

Reverted the yarn.lock file, yarn install, close the metro terminal window, did run-ios again and the error was gone. Bear in mind a few different babel dependencies are upgraded along with the core package.

Hope this helps.

The same problem :(

same issue :(

Babel 7.7.0 was released today

same issue :(

Anybody able to successfully workaround this?

Working fine for me as well :

  1. delete node_modules
  2. npm install again

Don't change the pods

With the new "@babel/runtime": "7.7.1"it solves the problem. Thank you, guys :)

Was this page helpful?
0 / 5 - 0 ratings