-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
main.jsbundle does not exist. This must be a bug with React Native. metro/src/lib/polyfills/require.js: Unexpected token, expected "," #25397
Comments
Fixed it with @nishiltamboli and @nadbm comments from #15432 I had a similar problem with node version. What I did was Open console and type the command > which node to export NODE_BINARY=<PATH_FROM_WHICH_NODE> So for me, I changed it to export NODE_BINARY=/Users//.nvm/versions/node/v10.14.1/bin/node Thats it! Hope it helps someone. |
In my case, the metro bundler's project path that was running in background is not belonged to the project that I was trying to build. |
That's the true issue, when switching project… Good catch |
Other case. I had the next line of code: __DEV__ = false (don't judge me) which doesn't break anything during the development, but breaks the build during release with original error message in the topic. react-native bundle --minify --entry-file index.js --platform ios --dev false --bundle-output main.jsbundle In my case the response was pretty clear:
|
I love you, you save my life. <3 |
In my case, this error caused because of monorepo setup and React Native Cli project root.
.
|-- package.json
|-- packages
| `-- app
| |- App.tsx # react native app
| `- ios # native modules
|-- node_modules
| `-- react-native
| `- scripts
| `- react-native-xcode.sh # which will be invoked by Xcode
`-- cli.js # My custom cli My Custom process.chdir('./packages/app')
var cli = require('@react-native-community/cli')
cli.run() Thus, I've changed export NODE_BINARY=node
export CLI_PATH=./cli.js // <-- Add this line
../../../node_modules/react-native/scripts/react-native-xcode.sh Hope this helps someone like me. |
Don't forget close all metro bundler's (include current app develop bundler) before start build. It solved problem for me. |
this article saved my day |
Archive in XCode lead to the error:
main.jsbundle does not exist. This must be a bug with React Native. metro/src/lib/polyfills/require.js: Unexpected token, expected ","
React Native version:
Steps To Reproduce
node_modules/metro/package.json
node_modules/metro/src/lib/polyfills/require.js
meanwhile
react-native run-ios
works without any errors.Related issues: #15432
The text was updated successfully, but these errors were encountered: