React Native: error: bundling failed: index.js: "" is not a valid identifer name

I have a React Native app which was running perfectly earlier this morning. I've deleted package-lock.json after mistakenly doing an npm install instead of a yarn install. Then I've ran yarn install and now when I try to run my app I get this error at the packager:

error: bundling failed: index.js: "" is not a valid identifer name
BUNDLE  [ios, dev] ./index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.

I've also closed packager and Vscode, removed node_modules and tried running yarn install again but I get the same error. I haven't changed a single line in my code and it was working before that.

What is going on?

It is already opened as an issue.

https://github.com/facebook/react-native/issues/27118

https://github.com/facebook/react-native/issues/27120#issuecomment-549832676

Simply you need to delete "node_modules" and again run the command:

npm i or yarn

Also, you can simply re-create the scratch project with

react-native init example

It will work as expected. They reverted the changes on @babel/run-time at 7.7.1 version.

Have fun 🎊🎉

error: bundling failed: Error: Unable to resolve module `./../react , error: bundling failed: Error: Unable to resolve module `. /Users/sturm/Desktop/ react-transform-hmr/lib/index.js(.native||.android.js|.native.js|.js� Please don't delete the node modules folder. The bundler has least to deal with node modules folder. Instead close all the terminals. If using VS-code close that also.

Delete node_modules and packages-lock.json, erase trash, close Metro Bundle, delete the app from emulator/simulator and run npm install, this way worked for me.

React Native: error: bundling failed: index.js: "" is not a valid identifer , That looks like an issue related to metro. Try to close console and in the project folder run: rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/metro-*� @hramos not sure, because I think that it would be something to be tested on the "Metro CI" side - but not even sure about it, since the issue was about the run command spawning the instance of the bundler 🤔 The underlying issue is that the version of Metro that react-native init uses is latest and is not fixed, so that's another way we could approach having this kind of issues.

I had the same issue and none of the solutions mentioned here or in the links worked for me. The issue was the react-native local and global versions were different.

node node_modules/react-native/local-cli/cli.js run-ios worked for me.

and while bundling, node node_modules/react-native/local-cli/cli.js bundle --entry-file...

In short replace react-native with node node_modules/react-native/local-cli/cli.js when trying to run or bundle

error: bundling failed: ReferenceError: SHA-1 for file index.js, js`: react-native-screens could not be found within the project. Answers : well i have solved this by reinstalling / updating these packages. npm� This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

[React Native][react-navigation]bundling failed: Error: Unable to , Issue Build Environment react: 16.3.0 react-native: 0.55.0 Steps to reproduce When NET SDK � Node.js SDK � PHP SDK � Python SDK � Ruby SDK When running the bundle, following error occurrs: bundling failed: Error: D:\\project\ node_modules\@splitsoftware\splitio\lib\utils\logger\LoggerFactory.js� React native project runs well in iphone. But after building on android device, it crashes when I open the app. I made index.android.bundle file by using this command.

Running bundle using React Native and Javascript SDK cause error , The module ./animations could not be found from /home/dell/Projects/javascript- projects/dora3_mobile/node_modules/react-native-modal/src/index.js . Indeed� Hi everyone! It looks like there are a few different issues reported here, and since the original issue is closed, I'm going to ask that new comments on this issue be reported as new issues if they have a new problem or previous fixes aren't working.

[Solved]react native modal error: bundling failed: Error: Unable to , unable to resolve react-navigation/native'' from './app js unable to resolve module node_modules/react error: bundling failed index js is not a valid identifer name FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':app: install Debug'. com .android. builder. testing. a pi. Device Exception: com

Comments
  • I've already tried it as I've said. I've worked around it by reverting to an old commit.
  • Can you check the @babel/run-time version?
  • Didn't work for me. Reverting to an old version of my package.json worked for me.