Skip to content
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 #29356

Closed
ivarchand opened this issue Jul 13, 2020 · 24 comments
Closed

main.jsbundle does not exist. This must be a bug with #29356

ivarchand opened this issue Jul 13, 2020 · 24 comments
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.

Comments

@ivarchand
Copy link

ivarchand commented Jul 13, 2020

'error: File /Users/user/Library/Developer/Xcode/DerivedData/NewApp-fvicxnfjlfuonigoqscurptyhntn/Build/Products/Release-iphonesimulator/NewApp.app/main.jsbundle does not exist. This must be a bug with'

React Native version:

react-native info

warn Your project is using deprecated "rnpm" config that will stop working from next release. Please use a "react-native.config.js" file to configure the React Native CLI. Migration guide: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
warn The following packages use deprecated "rnpm" config that will stop working from next release:

Binaries:
Node: 10.18.0 - /usr/local/opt/node@10/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.13.4 - /usr/local/opt/node@10/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman

SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28
Build Tools: 25.0.0, 25.0.1, 25.0.2, 26.0.1, 26.0.2, 27.0.3, 28.0.0, 28.0.3, 29.0.2
System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs ARM EABI v7a, android-23 | Google APIs Intel x86 Atom_64, android-26 | Android TV Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom_64, android-26 | Google Play Intel x86 Atom, android-28 | Android TV Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64

IDEs:
Android Studio: 3.5 AI-191.8026.42.35.6010548
Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild

npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.1 => 0.61.1

npmGlobalPackages:
react-native-cli: 2.0.1
react-native-log-ios: 1.5.0

Steps To Reproduce

issue:
'error: File /Users/user/Library/Developer/Xcode/DerivedData/NewApp-fvicxnfjlfuonigoqscurptyhntn/Build/Products/Release-iphonesimulator/NewApp.app/main.jsbundle does not exist. This must be a bug with'

Provide a detailed list of steps that reproduce the issue.

  1. running the app in debug mode i.e., product -> Edit Scheme -> Debug -> Debug Executable enabled - works fine.
  2. running the app release mode i.e., product -> Edit Scheme -> Release -> Debug Executable enabled - main.jsbundle does not exist. This must be a bug with

ways triaged to fix issue are below:

quit the currently running metro-bundler
quit the tsc compiler
quit xcode & simulator
sudo rm -rf node_modules
sudo yarn
applying permission Read & Write manually to node_modules & all of it's enclosed items
sudo watchman watch-del-all
sudo lsof -i :8081
sudo kill -9 processId
open ios/ProjectName.xcworkspace

But i have not reached any solution so far.
As i said before, on debug mode, it works fine, on release mode, throws the error and app did not launch

please help me out to fix this issue & go ahead

Thanks in Advance

@react-native-bot react-native-bot added the Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used. label Jul 13, 2020
@voidrender
Copy link

This fixed it for me:
#29351 (comment)
#29351 (comment)

@ivarchand
Copy link
Author

ivarchand commented Jul 14, 2020

Thanks @ioveracker

Initially, just tried to get the value of $PROJECT_DIR on terminal but no error & no output. so, .bash_profile is updated like below

export PATH="/usr/local/opt/node@10/bin:$PATH"
export JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home'
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH="~/Library/Android/sdk/emulator:${PATH}"
export REACT_EDITOR=vscode
export PATH="/usr/local/opt/python/libexec/bin:$PATH"

export PROJECT_DIR="/Users/user/Documents/projects/projectRepo/ocb"

alias OPEN_DEV_MENU='adb shell input keyevent 82'

and then, followed those steps of #29351 (comment) & made changes at Build Phases -> Bundle React Native Code and Images

cd $PROJECT_DIR/..
export NODE_BINARY=$(which node)
./node_modules/react-native/scripts/react-native-xcode.sh

But still it produces the same error

  • echo 'error: File /Users/user/Library/Developer/Xcode/DerivedData/NewApp-fvicxnfjlfuonigoqscurptyhntn/Build/Products/Release-iphonesimulator/NewApp.app/main.jsbundle does not exist. This must be a bug with'

if you have any idea, please share

Thanks

@ivarchand
Copy link
Author

ivarchand commented Jul 14, 2020

Hi @ioveracker,

react-native bundle & #18313 helps me to fix this issue
react-native bundle --help

builds the javascript bundle for offline use

Options:
--entry-file Path to the root JS file, either absolute or relative to JS root
--platform [string] Either "ios" or "android" (default: "ios")
--transformer [string] Specify a custom transformer to be used
--dev [boolean] If false, warnings are disabled and the bundle is minified (default: true)
--minify [boolean] Allows overriding whether bundle is minified. This defaults to false if dev is true, and true if dev is false. Disabling minification can be useful for speeding up production builds for testing purposes.
--bundle-output File name where to store the resulting bundle, ex. /tmp/groups.bundle
--bundle-encoding [string] Encoding the bundle should be written in (https://nodejs.org/api/buffer.html#buffer_buffer). (default: "utf8")
--max-workers [number] Specifies the maximum number of workers the worker-pool will spawn for transforming files. This defaults to the number of the cores available on your machine.
--sourcemap-output [string] File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map
--sourcemap-sources-root [string] Path to make sourcemap's sources entries relative to, ex. /root/dir
--sourcemap-use-absolute-path Report SourceMapURL using its full path
--assets-dest [string] Directory name where to store assets referenced in the bundle
--reset-cache Removes cached files
--read-global-cache Try to fetch transformed JS code from the global cache, if configured.
--config [string] Path to the CLI configuration file
-h, --help output usage information

Finally, to fix this issue, i added
"build:ios": "react-native bundle --entry-file='index.ios.js' --bundle-output='./ios/NewApp/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'"
in "scripts" of package.json
& then run this command -> yarn build:ios

Works fine!!

Thanks

@nadeka
Copy link

nadeka commented Jul 15, 2020

For me, the bundle command executed by react-native-xcode.sh tried to use the wrong index file and the solution in this Stack Overflow answer worked.

@stefanoeb
Copy link

In my case, when compiling the bundle in release mode it was throwing a JS error, regarding using numbers like 15_000 instead of 15000. I had to look in the xcode logs above the actual error to see the problem, for some reason the process did not return 1 🤷


+ node /Users/stefanoeb/src/ahdy/mobile/node_modules/react-native/cli.js bundle --entry-file index.js --platform ios --dev false --reset-cache --bundle-output /Users/stefanoeb/Library/Developer/Xcode/DerivedData/ahdy-hglwxejblbjhnzbadktqltkpuzfa/Build/Intermediates.noindex/ArchiveIntermediates/Ahdy/BuildProductsPath/Release-iphoneos/ahdy.app/main.jsbundle --assets-dest /Users/stefanoeb/Library/Developer/Xcode/DerivedData/ahdy-hglwxejblbjhnzbadktqltkpuzfa/Build/Intermediates.noindex/ArchiveIntermediates/Ahdy/BuildProductsPath/Release-iphoneos/ahdy.app

                 Welcome to React Native!

                Learn once, write anywhere





error src/services/FirebaseAnalytics.ts: Unexpected token name «_000», expected punc «)» in file src/services/FirebaseAnalytics.ts at 37:21. Run CLI with --verbose flag for more details.


@Robertroid
Copy link

For me, after struggling a bit with watchman, this problem appeared. The thing is, watchman found that a folder had "too much permissions" and suggested it to change it to chmod 0700. But, it wasn't actually a suggestion lol, instead this was blocking the bundle to build itself. After changing to the suggested permission it built nicely again

@KGDeveloper
Copy link

  • echo 'error: File /Users/princess/Library/Developer/Xcode/DerivedData/eclinicforyou-gcxudcipmrmxcjctdnshvjhqqnss/Build/Intermediates.noindex/ArchiveIntermediates/eclinicforyou/BuildProductsPath/Release-iphoneos/eclinicforyou.app/main.jsbundle does not exist. This must be a bug with'
    error: File /Users/princess/Library/Developer/Xcode/DerivedData/eclinicforyou-gcxudcipmrmxcjctdnshvjhqqnss/Build/Intermediates.noindex/ArchiveIntermediates/eclinicforyou/BuildProductsPath/Release-iphoneos/eclinicforyou.app/main.jsbundle does not exist. This must be a bug with
  • echo 'React Native, please report it here: https://github.com/facebook/react-native/issues'
    React Native, please report it here: https://github.com/facebook/react-native/issues
  • exit 2
    Welcome to React Native!
    Learn once, write anywhere

Failed to construct transformer: Error: Cannot create a string longer than 0x1fffffe8 characters
at Object.slice (buffer.js:608:37)
at Buffer.toString (buffer.js:805:14)
at Object.readFileSync (fs.js:421:41)
at getContent (/Users/princess/Documents/eclinicforyou2/node_modules/metro/node_modules/jest-haste-map/build/worker.js:149:41)
at Object. (/Users/princess/Documents/eclinicforyou2/node_modules/metro/node_modules/jest-haste-map/build/worker.js:199:9)
at Generator.next ()
at asyncGeneratorStep (/Users/princess/Documents/eclinicforyou2/node_modules/metro/node_modules/jest-haste-map/build/worker.js:78:24)
at _next (/Users/princess/Documents/eclinicforyou2/node_modules/metro/node_modules/jest-haste-map/build/worker.js:98:9)
at /Users/princess/Documents/eclinicforyou2/node_modules/metro/node_modules/jest-haste-map/build/worker.js:103:7
at new Promise () {
type: 'Error',
code: 'ERR_STRING_TOO_LONG'
}
Error: Error loading assets JSON from Metro. Ensure you've followed all expo-updates installation steps correctly. Cannot create a string longer than 0x1fffffe8 characters
at /Users/princess/Documents/eclinicforyou2/node_modules/expo-updates/scripts/createManifest.js:27:11
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:93:5)

This is my issue.
Who can help me?

Do you solve the problem? I have the same problem

@xlcrr
Copy link

xlcrr commented Feb 12, 2021

Upgrading react-native from 0.62 to 0.64 did it for me

@SohaibKtb
Copy link

@xlcrr can you please try to Archive a build now, because the error reappears for me with react-native v0.63.4

@xlcrr
Copy link

xlcrr commented Feb 22, 2021

@SohaibKtb yes I was able to archive last night

@SohaibKtb
Copy link

Weird, the error happens suddenly, I tried also with a new react-native project but still happening 🙁

@xlcrr
Copy link

xlcrr commented Feb 22, 2021

cd ios && pod install after npm update react-native

@SohaibKtb
Copy link

SohaibKtb commented Feb 22, 2021

same, here is the issue #31025 (comment)

@xilin
Copy link

xilin commented Feb 26, 2021

In my case, when compiling the bundle in release mode it was throwing a JS error, regarding using numbers like 15_000 instead of 15000. I had to look in the xcode logs above the actual error to see the problem, for some reason the process did not return 1 🤷


+ node /Users/stefanoeb/src/ahdy/mobile/node_modules/react-native/cli.js bundle --entry-file index.js --platform ios --dev false --reset-cache --bundle-output /Users/stefanoeb/Library/Developer/Xcode/DerivedData/ahdy-hglwxejblbjhnzbadktqltkpuzfa/Build/Intermediates.noindex/ArchiveIntermediates/Ahdy/BuildProductsPath/Release-iphoneos/ahdy.app/main.jsbundle --assets-dest /Users/stefanoeb/Library/Developer/Xcode/DerivedData/ahdy-hglwxejblbjhnzbadktqltkpuzfa/Build/Intermediates.noindex/ArchiveIntermediates/Ahdy/BuildProductsPath/Release-iphoneos/ahdy.app

                 Welcome to React Native!

                Learn once, write anywhere





error src/services/FirebaseAnalytics.ts: Unexpected token name «_000», expected punc «)» in file src/services/FirebaseAnalytics.ts at 37:21. Run CLI with --verbose flag for more details.

@stefanoeb May I ask how can we see the failure reason in the log?

@Twisterking
Copy link

I tried absolutely everything I could find here and anywhere else but nothing helps - always ending up with the same error:

File /Users/patrick/Library/Developer/Xcode/DerivedData/MyApp-efgagvetcbkxwfajisiotrtujzmg/Build/Products/Staging-iphoneos/MyApp.app/main.jsbundle does not exist. This must be a bug with

I even checked the dir and indeed, there is NO main.jsbundle file in there.
I updated vom 0.63.2 to 0.63.4, I tried pretty much everything 😢 ... can anyone help?

@e1016
Copy link

e1016 commented Mar 16, 2021

@Twisterking must be a syntax error on your JS

"build:ios": "react-native bundle --entry-file='index.ios.js' --bundle-output='./ios/NewApp/main.jsbundle' --dev=false --platform='ios' --assets-dest='./iOS'"
in "scripts" of package.json
& then run this command -> npm run build:ios you should see the error in console

@neutrous
Copy link

For people who may encounter the same issue, just try to check your node or react native command could be found by XCode. Sometimes, this might be an issue if you are using nvm or fnm, especially when you are switching node versions.

@stefanoeb
Copy link

In my case, when compiling the bundle in release mode it was throwing a JS error, regarding using numbers like 15_000 instead of 15000. I had to look in the xcode logs above the actual error to see the problem, for some reason the process did not return 1 🤷


+ node /Users/stefanoeb/src/ahdy/mobile/node_modules/react-native/cli.js bundle --entry-file index.js --platform ios --dev false --reset-cache --bundle-output /Users/stefanoeb/Library/Developer/Xcode/DerivedData/ahdy-hglwxejblbjhnzbadktqltkpuzfa/Build/Intermediates.noindex/ArchiveIntermediates/Ahdy/BuildProductsPath/Release-iphoneos/ahdy.app/main.jsbundle --assets-dest /Users/stefanoeb/Library/Developer/Xcode/DerivedData/ahdy-hglwxejblbjhnzbadktqltkpuzfa/Build/Intermediates.noindex/ArchiveIntermediates/Ahdy/BuildProductsPath/Release-iphoneos/ahdy.app

                 Welcome to React Native!

                Learn once, write anywhere





error src/services/FirebaseAnalytics.ts: Unexpected token name «_000», expected punc «)» in file src/services/FirebaseAnalytics.ts at 37:21. Run CLI with --verbose flag for more details.

@stefanoeb May I ask how can we see the failure reason in the log?

@xilin If you're building with Xcode check this place out:
Bildschirmfoto 2021-03-23 um 19 26 43

If you're using the CLI (like react-native run-ios) the output will be on the terminal directly, although it will be messy

@xilin
Copy link

xilin commented Mar 28, 2021

In my case, when compiling the bundle in release mode it was throwing a JS error, regarding using numbers like 15_000 instead of 15000. I had to look in the xcode logs above the actual error to see the problem, for some reason the process did not return 1 🤷


+ node /Users/stefanoeb/src/ahdy/mobile/node_modules/react-native/cli.js bundle --entry-file index.js --platform ios --dev false --reset-cache --bundle-output /Users/stefanoeb/Library/Developer/Xcode/DerivedData/ahdy-hglwxejblbjhnzbadktqltkpuzfa/Build/Intermediates.noindex/ArchiveIntermediates/Ahdy/BuildProductsPath/Release-iphoneos/ahdy.app/main.jsbundle --assets-dest /Users/stefanoeb/Library/Developer/Xcode/DerivedData/ahdy-hglwxejblbjhnzbadktqltkpuzfa/Build/Intermediates.noindex/ArchiveIntermediates/Ahdy/BuildProductsPath/Release-iphoneos/ahdy.app

                 Welcome to React Native!

                Learn once, write anywhere





error src/services/FirebaseAnalytics.ts: Unexpected token name «_000», expected punc «)» in file src/services/FirebaseAnalytics.ts at 37:21. Run CLI with --verbose flag for more details.

@stefanoeb May I ask how can we see the failure reason in the log?

@xilin If you're building with Xcode check this place out:
Bildschirmfoto 2021-03-23 um 19 26 43

If you're using the CLI (like react-native run-ios) the output will be on the terminal directly, although it will be messy

Thanks. We use fastlane gym running with Jenkins, which is a little different. Will try to find it in log next time.

@vegidio
Copy link

vegidio commented Apr 8, 2021

@stefanoeb Thanks, that was my case as well. I find crazy how it works fine during development, but only fails when I try to generate a build to production. I spent an entire day today trying to figure out what was wrong until I found your message 😡

Thanks again for helping!

@munkhorgil
Copy link

For people who may encounter the same issue, just try to check your node or react native command could be found by XCode. Sometimes, this might be an issue if you are using nvm or fnm, especially when you are switching node versions.

This was the case for me, I was using node v14.16.1 which worked fine, then switched to v15.14.0 where it started to fail in production release.

@ghost
Copy link

ghost commented May 17, 2021

The same error encountered after switching from 15 to 16 Node version. My solution was to remove and install again node_modules folder, but I hardly see why this helped.

@my-name-is-nheo
Copy link

The same error encountered after switching from 15 to 16 Node version. My solution was to remove and install again node_modules folder, but I hardly see why this helped.

@haruhiroYakumo right?! closing simulator and reinstalling the pods were my solutions

what is the reason for this issue?

@ngsayjoe
Copy link

Turned out there was a syntax error in my source code, fixing the syntax error fixed the missing bundle error when archiving in Xcode. Not sure why Xcode didn't report the syntax error while bundling for Android in command-line did.

@facebook facebook locked as resolved and limited conversation to collaborators Oct 1, 2021
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.
Projects
None yet
Development

No branches or pull requests