Closed hanishsharma closed 7 years ago
This happens when there is no offline bundle file in your project, I had the same problem and this worked for me.
If you're running on the device, check the Running On Device docs
I added the below to my package.json
file so I don't have to type it every time I want to generate an offline bundle
"build:ios": "react-native bundle --entry-file='index.ios.js' --bundle-output='./ios/YourAppName/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'"
And you can run it like this npm run build:ios
You'll see the main.jsbundle
file generated inside your ios/YourAppName
directory
Next, open your project using XCode, right click on your project name then click Add Files to "YourProjectName"
, choose the main.jsbundle
file that was generated, and then build again.
That should do it.
I'm using
"react": "16.0.0-alpha.12",
"react-native": "0.46.1",
Not sure if this is the answer, but this issue went away for me when I moved my type declaration packages from devDependencies
to dependencies
in package.json.
The packages were @types/react
, @types/react-native
, @types/react-navigation
.
@scottyantipa Can you elaborate on that? What packages? and what type declaration
? That would help me a lot! 😄
@lolobosse I updated my comment above
@scottyantipa I found my error, it was a weird \
in a string.
I had to debug the bundler and I saw the file crashing.
@ReactNative Team: that would be great that if the --verbose
option is activated, you deliver more logs than just SyntaxError
on the bundler 😄
For this issue was caused because the index.ios.js
file was not located in the root directory of the repo. I had to modify the Build Phases
-> Bundle React Native code and images
script in Xcode to point it to the correct directory.
Original (what react native generated):
export NODE_BINARY=node
../node_modules/react-native/scripts/react-native-xcode.sh
Fixed:
export NODE_BINARY=node
../node_modules/react-native/scripts/react-native-xcode.sh ./src/index.ios.js
I had a similar error after doing a pull of a repo upgraded to 0.48.4 (someone else did the RN upgrading).
Doing
rm -rf ./node_modules && npm install
showed this error, but doing:
rm -rf ./node_modules && yarn
actually fixed it. So I guess there are subtle differences on how yarn and git handle install scripts.
@lolobosse What string was the / in? React Native code, or somewhere in XCode?
@johndanek The node_modules
directory is always at the root of your project (React Native code).
Tried all of above, problem still persisting. Why was this closed @hanishsharma ?
Hi , I am using react-native 0.49, I get this error on device only , it works fine on Simulator. I tried many things but none worked.
@hanishsharma Why did you close this?
I just got this, and that was just that the bundle wasn't building correctly.
I started dev mode and found an fatal error that were blocking compilation (a bad require). It was that simple.
I had this issue as well when I tried to create an archive in Xcode.
For me, it was because the command to build the JS bundle was failing, and the reason it was failing was because one of my dependencies had a specific babel preset in its .babelrc
file, which I did not have installed in my main React Native project's package.json
.
In the Xcode error output, a few lines above the "main.jsbundle does not exist" line, I had the following error message from the react-native bundle
command that had run:
TransformError: /Users/jordan/Development/MyAppName/node_modules/dotenv-parse-variables/lib/index.js: Unknown plugin "add-module-exports" specified in "/Users/jordan/Development/MyAppName/node_modules/dotenv-parse-variables/.babelrc" at 0, attempted to resolve relative to "/Users/jordan/Development/MyAppName/node_modules/dotenv-parse-variables"
So I installed the missing plugin by running: yarn add --dev babel-plugin-add-module-exports
I then went to Xcode again, did a Product -> Clean, then Product -> Archive, and this time it worked.
I actually used to have these dependency-related babel plugins installed, but I removed them because the release notes for 0.50.0 (https://github.com/facebook/react-native/releases/tag/v0.50.0) stated that this wouldn't be required anymore due to the change in enableBabelRCLookup. But I guess that change isn't quite working correctly, so for now we'll have to keep using the workaround I used here, or the postinstall workaround that they describe in those release notes.
For reference, here's my dependencies:
"react": "16.0.0",
"react-native": "0.50.3"
Just to share something that I've found out about this issue.
I can build for debug, but when build for release, RN throws the error
Clean different sorts of cache / reinstall node npm / change xcode settings etc have nothing to do with my issue
A clean new project with react-native init has exactly the same issue
Sometimes it's caused by typos, you can build for debug to see if its caused by typos. If debug build succeeds, then your js files are all OK
If you have checked all above items and still face the issue, finally, it's probably due to your network environment. When you develop on some internal networks that have atypical settings of firewall, you might face this issue. Just disable your wifi network on you Mac, then build for release on your phone / simulator, it should run as expected.
Took me some good 2 hours to find it out.
i have same problem, i use
"react": "16.0.0-alpha.12"
"react-native": "0.48.4"
i change in "node_modules/react-native/scripts/react-native-xcode.sh"
ENTRY_FILE=${1:-index.ios.js}
to
ENTRY_FILE=${1:-index.js}
The problem for me had to do with Apple's iCloud syncing my desktop and documents. For me the fix was moving the folder to a directory that wasn't synced with icloud in my ~
directory. I cloned the repo from git and stopped having these issues. Hope this helps someone, lost two days on this...
The key here is to look in Xcode, above the "main.jsbundle does not exist" message and see what the actual reason for the bundle not being created is:
In my case, the actual error (TransformError: /Users/dwilt/Documents/GitHub/the-resistance/firebaseFunctions/gameStructure.js: Cannot read property 'useBuiltIns' of undefined
) was caused from the release build failing to import a file from outside my src
directory - but only when building for release. Not sure why yet but moving the file to the src
directory solved it.
Not sure if I'm doing this correctly but I had this issue when trying to run react-native run-ios
after following the steps for running on device and getting the app ready for publishing to the app store.
I removed the following to enable App Transport Security:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
However, if I don't add it back in to my Info.plist when I want to debug, then I get the main.jsbundle missing error.
Hello guys! I tried everything that I read through github issues and google but I can't still find the solution for me. When I'm using the simulator everything is fine but when I try to make an archive or build it on my phone I have this error:
File /Users/.../Library/Developer/Xcode/DerivedData/<app_name>-cyixycawuftgogfcezlrqhtzvdyo/Build/Intermediates.noindex/ArchiveIntermediates/<app_name>/BuildProductsPath/Release-iphoneos/<app_name>.app/main.jsbundle does not exist
My dependencies are:
"react": "16.0.0",
"react-native": "0.50.3",
I will be very happy if anyone could help me because I am stuck with this issue from 2 days and I can't submit my app for test flight.
Just had this issue myself, turns out it was caused due to a space in one of my higher up folder names. I removed the space from the name and it sprang into life!
Find another case: Wrong case in file name。
> react-native bundle --entry-file='index.js' --bundle-output='./ios/StrongBox/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'
Scanning folders for symlinks in /Users/carb/WorkSpace/ReactNative/strong-box/node_modules (17ms)
Scanning folders for symlinks in /Users/carb/WorkSpace/ReactNative/strong-box/node_modules (32ms)
Loading dependency graph, done.
Loading dependency graph...
Unable to resolve module `./tools/UmPush` from `/Users/carb/WorkSpace/ReactNative/strong-box/src/main.js`: could not resolve `/Users/carb/WorkSpace/ReactNative/strong-box/src/tools/UmPush' as a file nor as a folder
The actual filename is UMPush.js
, I thought it was UmPush.js
, and git ignored it. (I changed the char case of file name and forgot git.😔)
Looks like the issue with spaces in the CLI path was fixed in #17628.
Hi, is there any difference in using unbundle
as BUNDLE_COMMAND
? https://facebook.github.io/react-native/docs/performance.html#unbundling-inline-requires
I am experiencing the following issue: https://stackoverflow.com/questions/48751053/react-native-unbundle-app-gets-hung-in-release
@cconstable @IbraheemAlSaady
Both your solutions didn’t work for me
"build:ios": "react-native bundle --entry-file='index.ios.js' --bundle-output='./ios/YourAppName/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'"
&
export NODE_BINARY=node ../node_modules/react-native/scripts/react-native-xcode.sh ./src/index.ios.js
@xeieshan
It seems to have worked for me, I had to add the file into xcode and add it into the "Build Phases"->"Copy Bundle Resources" in the target.
Assuming you've modified AppDelegate.m to load the resource instead of using RCTBundleURLProvider:
jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
Ran into this issue today and it turns out that invoking the build via a yarn script was the culprit. Using npm run
or just the raw commandline worked fine for me!
i did what IbraheemAlSaady told us to do and my app is having a a really weird behavior, it change all my aplications images/icons to theios/
folder, I dont know why or how this happened, please help my boss is gonna fire me
I'm having a similar issue has anyone had this issue before - https://stackoverflow.com/questions/49313917/react-native-app-can-build-for-debugging-but-not-for-archiving
got this error when library was added but forgot to run npm i / yarn npm i fixed it
This is my script : Create jsbundle and import to XCode. NB: I've integrated React-Native into an existing native app, so my RN code in into /js folder.
https://gist.github.com/matteocollina/ee92ee698ddfefceb8ce85c9d94d69df
if [ "$CONFIGURATION" == "Debug" ]; then
echo "Debug Configuration"
else
echo "Release Configuration"
cd js
react-native bundle --platform ios --dev false --entry-file index.ios.js --bundle-output main.jsbundle
RESOURCE_PATH=$SRCROOT/js
FILENAME_IN_BUNDLE=main.jsbundle
BUILD_APP_DIR=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app
cp $RESOURCE_PATH/$FILENAME_IN_BUNDLE $BUILD_APP_DIR/$FILENAME_IN_BUNDLE
echo "Copied jsbundle √"
fi
None of everything above worked for me. I had to change .babelrc
file to :
{
"presets": ["react-native"],
"plugins": ["transform-decorators-legacy"],
"sourceMaps": true
}
For me, it's because of remove some packages (via npm uninstall/yarn remove) but still have references in Xcode project.
The solution is goto Build Settings, then remove node_modules reference of deleted packages in "Framework Search Path" and "Header Search Paths".
Hope it help someone here.
Look above of the error, you will fine what exactly wrong when the shell script trying to package your js file. My problem is that I missed a , in an object definition!
Like many people, I came across this topic when I had the same mistake, which is why I want to share what really caused the problem :
Context :
We(@kisioDigitial) build our apps through jenkins which use fastlane (for release purpose), we didn't had any problem till 1 month but during this month we upgrade our react-native version from :
{ "react": "16.0.0-alpha.6", "react-native": "^0.44.0" }
to
{ "react": "^16.2.0", "react-native": "^0.52.2"}
It turns out that it's the same problem that npalethorpe got (https://github.com/facebook/react-native/issues/15432#issuecomment-359789055), Jenkins create directory workspace according to the build name which in our case had several spaces.
I'm not 100% sure that issue come from the react-native upgrade, but removing the space from the build name (so from the directory name) resolve the issue and build no longer fail on the main.jsbundle missing file
this occurred when I had a problem in directory js modules
@IbraheemAlSaady
npm run build:ios
npm ERR! missing script: build:ios
got this error after execute command
Useing Xcode to open the iOS project will solve this problem.
I find an easy way to solve it . you just run your project using simulator while not your Device at the first time. After you do it, it will have a local main.jsbundle file automatically and then you can run it on your Device success. it works for me, hope so with you.
I'm getting the issue when doing CD builds on Bitrise using the Xcode archive and export step. Here's the last bit of the log:
▸ Running script 'Bundle React Native code and images'
the transform cache was reset.
❌ error: File /Users/vagrant/Library/Developer/Xcode/DerivedData/zonder-dfxxvabfiixsrgbdsqgwkghxwehd/Build/Intermediates.noindex/ArchiveIntermediates/zonder/BuildProductsPath/Release-iphoneos/zonder.app/main.jsbundle does not exist. This must be a bug with React Native, please report it here: https://github.com/facebook/react-native/issues'
I'm confused because the build has been working very well for us for quite some time, and it just started failing. Additionally, I can't reproduce the issue locally via normal debug builds or via a local Xcode archive in release mode. Any thoughts on what I should look into next? I'm thinking about trying to nuke the node_modules cache for yarn first.
Thanks @futurechallenger , actual error was above the highlighted error!
@gfly 你搞定这个问题了?
For me it works on my local machine but it fails on the bitrise build, locally works with node 8 and 10 but on bitrise works only with node 8 (only with yarn)
I got the error "main.jsbundle does not exist" when I upgraded from 0.46.4 to 0.47. What helped in my case was to add or rename index.ios.js to just index.js. After this it worked fine.
For me, the build process was using an old version of node. I had it installed via nvm so modified the following (in Build Phases > Bundle React Native code)
export NODE_BINARY=node
../node_modules/react-native/scripts/react-native-xcode.sh
to
export NODE_BINARY=/Users/nadim54321/.nvm/versions/node/v10.3.0/bin/node
../node_modules/react-native/scripts/react-native-xcode.sh
react-native bundle --entry-file ./index.ios.js --platform ios --bundle-output ios/main.jsbundle
Run this command it should work.
In case none of this works for you, restarting my Mac fixed the issue 🤯
??
rollin luo
邮箱:luolin2611@gmail.com
Signature is customized by Netease Mail Master
On 09/13/2018 03:53, Robert Kuncewicz wrote: In case none of this works for you, restarting my Mac fixed the issue 🤯
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/facebook/react-native","title":"facebook/react-native","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/facebook/react-native"}},"updates":{"snippets":[{"icon":"PERSON","message":"@rkuncewicz in #15432: In case none of this works for you, restarting my Mac fixed the issue 🤯"}],"action":{"name":"View Issue","url":"https://github.com/facebook/react-native/issues/15432#issuecomment-420775284"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/facebook/react-native/issues/15432#issuecomment-420775284", "url": "https://github.com/facebook/react-native/issues/15432#issuecomment-420775284", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } }, { "@type": "MessageCard", "@context": "http://schema.org/extensions", "hideOriginalBody": "false", "originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB", "title": "Re: [facebook/react-native] main.jsbundle does not exist. This must be a bug with + echo 'React Native (#15432)", "sections": [ { "text": "", "activityTitle": "Robert Kuncewicz", "activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png", "activitySubtitle": "@rkuncewicz", "facts": [
] } ], "potentialAction": [ { "name": "Add a comment", "@type": "ActionCard", "inputs": [ { "isMultiLine": true, "@type": "TextInput", "id": "IssueComment", "isRequired": false } ], "actions": [ { "name": "Comment", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"facebook/react-native\",\n\"issueId\": 15432,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}" } ] }, { "targets": [ { "os": "default", "uri": "https://github.com/facebook/react-native/issues/15432#issuecomment-420775284" } ], "@type": "OpenUri", "name": "View on GitHub" }, { "name": "Unsubscribe", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 247993868\n}" } ], "themeColor": "26292E" } ]
Hi All, Did anyone faced this type of the issue?
/Users/vvinogradskiy/Work/eversleep/new/everSleep-React/node_modules/rx/dist/rx.all.js: Cannot convert object to primitive value
TypeError: Cannot convert object to primitive value
at _evaluate (/Users/vvinogradskiy/Work/eversleep/new/everSleep-React/node_modules/@babel/traverse/lib/path/evaluation.js:287:21)
at evaluateCached (/Users/vvinogradskiy/Work/eversleep/new/everSleep-React/node_modules/@babel/traverse/lib/path/evaluation.js:45:17)
at NodePath.evaluate (/Users/vvinogradskiy/Work/eversleep/new/everSleep-React/node_modules/@babel/traverse/lib/path/evaluation.js:405:15)
at evaluate (/Users/vvinogradskiy/Work/eversleep/new/everSleep-React/node_modules/metro/src/JSTransformer/worker/constant-folding-plugin.js:30:30)
at PluginPass.exit (/Users/vvinogradskiy/Work/eversleep/new/everSleep-React/node_modules/metro/src/JSTransformer/worker/constant-folding-plugin.js:79:22)
at newFn (/Users/vvinogradskiy/Work/eversleep/new/everSleep-React/node_modules/@babel/traverse/lib/visitors.js:193:21)
at NodePath._call (/Users/vvinogradskiy/Work/eversleep/new/everSleep-React/node_modules/@babel/traverse/lib/path/context.js:53:20)
at NodePath.call (/Users/vvinogradskiy/Work/eversleep/new/everSleep-React/node_modules/@babel/traverse/lib/path/context.js:40:17)
at NodePath.visit (/Users/vvinogradskiy/Work/eversleep/new/everSleep-React/node_modules/@babel/traverse/lib/path/context.js:97:8)
+ [[ false != true ]]
+ [[ ! -f /Users/vvinogradskiy/Library/Developer/Xcode/DerivedData/Eversleep2-bevmscnfjrhzdogjjxvskkcgvvpe/Build/Products/Release-iphoneos/Eversleep2.app/main.jsbundle ]]
+ echo 'error: File /Users/vvinogradskiy/Library/Developer/Xcode/DerivedData/Eversleep2-bevmscnfjrhzdogjjxvskkcgvvpe/Build/Products/Release-iphoneos/Eversleep2.app/main.jsbundle does not exist. This must be a bug with'
error: File /Users/vvinogradskiy/Library/Developer/Xcode/DerivedData/Eversleep2-bevmscnfjrhzdogjjxvskkcgvvpe/Build/Products/Release-iphoneos/Eversleep2.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
"@babel/core": "^7.1.2",
"@babel/runtime": "^7.1.2",
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.47.0",
"react-test-renderer": "16.5.0"
"react": "16.5.0",
"react-native": "0.57.1",
UPDATE: Found issue, unused import of import { AsyncSubject } from 'rx'; in one of the files. 3 days of pain
Hi everyone, I got this error invalid asset resolution
after I run this command react-native bundle --entry-file ./index.ios.js --platform ios --bundle-output ios/main.jsbundle
OS: macOS 10.14 Node: 10.11.0 Yarn: 1.9.4 npm: 6.4.1 Watchman: 4.9.0 Xcode: Xcode 9.4.1 Build version 9F2000 Android Studio: 3.2 AI-181.5540.7.32.5014246
react: 16.3.1 => 16.3.1 react-native: 0.55.4 => 0.55.4
When I want to make the archive (IPA) file or run this command react-native bundle --entry-file ./index.ios.js --platform ios --bundle-output ios/main.jsbundle
I face with this error
Scanning folders for symlinks in /Users/(UserName)/(AppName)-IPA/trunk/node_modules (18ms)
Scanning folders for symlinks in /Users/(UserName)/(AppName)-IPA/trunk/node_modules (28ms)
Loading dependency graph, done.
warning: the transform cache was reset.
invalid asset resolution
+ [[ false != true ]]
+ [[ ! -f /Users/(UserName)/Library/Developer/Xcode/DerivedData/(AppName)-cnblsqqaiazcukboapcwusllmldm/Build/Intermediates.noindex/ArchiveIntermediates/dara/BuildProductsPath/Release-iphoneos/(AppName).app/main.jsbundle ]]
+ echo 'error: File /Users/(UserName)/Library/Developer/Xcode/DerivedData/(AppName)-cnblsqqaiazcukboapcwusllmldm/Build/Intermediates.noindex/ArchiveIntermediates/(AppName)/BuildProductsPath/Release-iphoneos/(AppName).app/main.jsbundle does not exist. This must be a bug with'
error: File /Users/(UserName)/Library/Developer/Xcode/DerivedData/(AppName)-cnblsqqaiazcukboapcwusllmldm/Build/Intermediates.noindex/ArchiveIntermediates/(AppName)/BuildProductsPath/Release-iphoneos/(AppName).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
I follow this https://stackoverflow.com/questions/49505446/main-jsbundle-does-not-exist-this-must-be-a-bug-with-echo-react-native
It would be great if help me :)
Hello team,
I am getting this error while running my xcode project.
main.jsbundle does not exist. This must be a bug with + echo 'React Native.
Please help.
Thanks.