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 #1509

Closed
dancamdev opened this issue Nov 9, 2022 · 17 comments
Closed

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

dancamdev opened this issue Nov 9, 2022 · 17 comments

Comments

@dancamdev
Copy link

This happens only when building the app with EAS namely during the fast lane step.

I've seen it in other react native related issues and they suggested to edit some files in Xcode, but I would like to keep the project expo managed, so I'm not sure how to fix it.

Here's part of the build log, I think is most relevant:

[RUN_FASTLANE] › Linking   Luffarelli » Luffarelli
[RUN_FASTLANE] ⚠️  ld: duplicate method '+moduleName' in
┌─[category]: ExpoBridgeModule-51af6d930ad374d100647ad3841ef291.o ExpoModulesCore/libExpoModulesCore.a
└─[class]: ExpoBridgeModule-a5e73f1bbab418e7b2a8cab5f33b1042.o ExpoModulesCore/libExpoModulesCore.a

[RUN_FASTLANE] ⚠️  ld: method '+UIStatusBarAnimation:' in category from /Users/daniele/Library/Developer/Xcode/DerivedData/Luffarelli-caqrovrlgcytbshiaqxicjigkuut/Build/Intermediates.noindex/ArchiveIntermediates/Luffarelli/BuildProductsPath/Release-iphoneos/React-CoreModules/libReact-CoreModules.a(RCTStatusBarManager.o) conflicts with same method from another category
[RUN_FASTLANE] › Generating debug Luffarelli » Luffarelli.app.dSYM
[RUN_FASTLANE] › Executing Luffarelli » Bundle React Native code and images
[RUN_FASTLANE]     the transform cache was reset.
[RUN_FASTLANE]
❌  error: File /Users/daniele/Library/Developer/Xcode/DerivedData/Luffarelli-caqrovrlgcytbshiaqxicjigkuut/Build/Intermediates.noindex/ArchiveIntermediates/Luffarelli/BuildProductsPath/Release-iphoneos/Luffarelli.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


[RUN_FASTLANE]     Run script build phase '[CP-User] Generate app.config for prebuilt Constants.manifest' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'EXConstants' from project 'Pods')
[RUN_FASTLANE] ▸ ** ARCHIVE FAILED **
[RUN_FASTLANE] ▸ The following build commands failed:
[RUN_FASTLANE] ▸ 	PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/daniele/Library/Developer/Xcode/DerivedData/Luffarelli-caqrovrlgcytbshiaqxicjigkuut/Build/Intermediates.noindex/ArchiveIntermediates/Luffarelli/IntermediateBuildFilesPath/Luffarelli.build/Release-iphoneos/Luffarelli.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'Luffarelli' from project 'Luffarelli')
[RUN_FASTLANE] ▸ (1 failure)
[RUN_FASTLANE] ** ARCHIVE FAILED **
[RUN_FASTLANE]
[RUN_FASTLANE]
[RUN_FASTLANE] The following build commands failed:
[RUN_FASTLANE] 	PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/daniele/Library/Developer/Xcode/DerivedData/Luffarelli-caqrovrlgcytbshiaqxicjigkuut/Build/Intermediates.noindex/ArchiveIntermediates/Luffarelli/IntermediateBuildFilesPath/Luffarelli.build/Release-iphoneos/Luffarelli.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'Luffarelli' from project 'Luffarelli')
[RUN_FASTLANE] (1 failure)
[RUN_FASTLANE] Exit status: 65
[RUN_FASTLANE]
[RUN_FASTLANE] +-------------+-------------------------+
[RUN_FASTLANE] |           Build environment           |
[RUN_FASTLANE] +-------------+-------------------------+
[RUN_FASTLANE] | xcode_path  | /Applications/Xcode.app |
[RUN_FASTLANE] | gym_version | 2.205.1                 |
[RUN_FASTLANE] | sdk         | iPhoneOS16.0.sdk        |
[RUN_FASTLANE] +-------------+-------------------------+
[RUN_FASTLANE] Looks like fastlane ran into a build/archive error with your project
[RUN_FASTLANE] It's hard to tell what's causing the error, so we wrote some guides on how
[RUN_FASTLANE] to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[RUN_FASTLANE] Before submitting an issue on GitHub, please follow the guide above and make
[RUN_FASTLANE] sure your project is set up correctly.
[RUN_FASTLANE] fastlane uses `xcodebuild` commands to generate your binary, you can see the
[RUN_FASTLANE] the full commands printed out in yellow in the above log.
[RUN_FASTLANE] Make sure to inspect the output above, as usually you'll find more error information there
[RUN_FASTLANE] [!] Error building the application - see the log above
[RUN_FASTLANE] Error: Fastlane build failed with unknown error. See logs for the "Run fastlane" and "Xcode Logs" phases for more information.
Fastlane errors in most cases are not printed at the end of the output, so you may not find any useful information in the last lines of output when looking for an error message.
[CLEAN_UP_CREDENTIALS] Destroying keychain - /var/folders/yv/415_mqjn13j0c7np7mskxf9r0000gn/T/turtle-v2-2439e84c-47ae-499e-beea-2d3089dc01f3.keychain
[CLEAN_UP_CREDENTIALS] Removing provisioning profile

Build failed
Fastlane build failed with unknown error. See logs for the "Run fastlane" and "Xcode Logs" phases for more information.
Fastlane errors in most cases are not printed at the end of the output, so you may not find any useful information in the last lines of output when looking for an error message.
    Error: npx exited with non-zero code: 1
@wkozyra95
Copy link
Contributor

There are few potential reasons why this could happen:

  • You have an error in your typescript and it does not compile. You can check Xcode logs for the actual error, they are available in the last section of logs on the build page.
  • You might have ejected unintentionally and there is sth broken in the native code. Make sure that you do not have android/ios directories.

If the above does not help please provide link to non local build where this happens

@Looveh
Copy link

Looveh commented Nov 9, 2022

I'm seeing the same error and I neither have typescript errors nor ejected unintentionally.

The error started appearing after upgrading Expo v0.46 -> 0.47 and I'm now unable to build the app on an M1 Mac.

Can't find any useful info in XCode logs to help me debug the issue.

@dancamdev
Copy link
Author

Upon further digging into the xcode logs I found something:

error hooks/useFilters.ts: Unexpected token name «_000», expected punc «,» in file hooks/useFilters.ts at 27:11.
Error: Unexpected token name «_000», expected punc «,» in file hooks/useFilters.ts at 27:11
    at minifyCode (/Users/expo/workingdir/build/app/node_modules/metro-transform-worker/src/index.js:101:13)
    at transformJS (/Users/expo/workingdir/build/app/node_modules/metro-transform-worker/src/index.js:319:28)
    at transformJSWithBabel (/Users/expo/workingdir/build/app/node_modules/metro-transform-worker/src/index.js:410:16)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.transform (/Users/expo/workingdir/build/app/node_modules/metro-transform-worker/src/index.js:571:12)

I checked this useFilters file, but no issue in sight within the editor or when running the app in debug mode, I suspect something breaks during minification

cc @wkozyra95

@wkozyra95
Copy link
Contributor

wkozyra95 commented Nov 10, 2022

@dancamdev I'm not sure if it's bug in react-native or expected behavior, either way not really EAS issue.

To fix that you just need to remove underscores from number literals. e.g. You probably have sth like 10_000, just change it to 10000

facebook/react-native#31551
facebook/metro#645

@acidjunk
Copy link

acidjunk commented Dec 5, 2022

Same error after upgrade here.

Copying   ios/iMprovisertest/Supporting/Expo.plist ➜ ./Expo.plist
› Compiling iMprovisertest » SplashScreen.storyboard
› Compiling iMprovisertest » noop-file.swift
› Compiling iMprovisertest » ExpoModulesProvider.swift
› Compiling iMprovisertest » main.m
› Compiling iMprovisertest » iMprovisertest_vers.c
› Preparing iMprovisertest » Info.plist
› Compiling iMprovisertest » AppDelegate.mm
› Linking   iMprovisertest » iMprovisertest
⚠️  ld: duplicate method '+moduleName' in
┌─[category]: ExpoBridgeModule-7b46aa804acfb7763ddc0cd6ede4c490.o ExpoModulesCore/libExpoModulesCore.a
└─[class]: ExpoBridgeModule-29c4d6149f00ed24e1c1639cb41e56a7.o ExpoModulesCore/libExpoModulesCore.a
⚠️  ld: method '+UIStatusBarAnimation:' in category from /Users/expo/Library/Developer/Xcode/DerivedData/iMprovisertest-gyvhktofygdlsmfnpmlbgjalwuxv/Build/Intermediates.noindex/ArchiveIntermediates/iMprovisertest/BuildProductsPath/Release-iphoneos/React-CoreModules/libReact-CoreModules.a(RCTStatusBarManager.o) conflicts with same method from another category
› Generating debug iMprovisertest » iMprovisertest.app.dSYM
› Executing iMprovisertest » Bundle React Native code and images
    the transform cache was reset.

❌  error: File /Users/expo/Library/Developer/Xcode/DerivedData/iMprovisertest-gyvhktofygdlsmfnpmlbgjalwuxv/Build/Intermediates.noindex/ArchiveIntermediates/iMprovisertest/BuildProductsPath/Release-iphoneos/iMprovisertest.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

@hugohow
Copy link

hugohow commented Dec 7, 2022

same for me

@acidjunk
Copy link

acidjunk commented Dec 7, 2022

I solved my problem by looking at the logs when the app starts on an iPhone. There I saw it tried to import something with errors (SVG related). So I removed @fortawesome/free-regular-svg-icons, @fortawesome/free-solid-svg-icons from my deps, and commented some stuff in the app that used these icons and now the EAS build works

@ReeceKenney
Copy link

I solved my problem by looking at the logs when the app starts on an iPhone. There I saw it tried to import something with errors (SVG related). So I removed @fortawesome/free-regular-svg-icons, @fortawesome/free-solid-svg-icons from my deps, and commented some stuff in the app that used these icons and now the EAS build works

I'm also seeing this problem and am using various @FortAwesome SVG icons in my project. I'm using them in quite a lot of places though so I haven't removed them to be able to verify this is the issue. May I ask where you saw the logs which mentioned an SVG related error? When I start my app using either expo go or a development build (both on the simulator) I don't see any errors.

@dk253
Copy link

dk253 commented Jan 15, 2023

I am still seeing this problem. I have tried backtracking my package.json and removing everything I can think of. No love.

@ReeceKenney
Copy link

ReeceKenney commented Jan 15, 2023

I was able to resolve my issue. Instead of removing font awesome, I actually used deep imports. So this:

import { faChevronRight } from "@fortawesome/pro-regular-svg-icons";

Became this:
import { faChevronRight } from "@fortawesome/pro-regular-svg-icons/faChevronRight";

I then repeated this for all my font awesome icon usage across my app. I guess this way, it only adds the icons we're using, rather than all of them. After this, my app built successfully.

@cmeyer90
Copy link

I was seeing this problem as well but seem to have found a solution. I commented out aws-exports.js in my .gitignore. I am using AWS amplify on my project. This file was not being included when uploaded to eas since it was in .gitignore. You can review your xcode log for more details - this is where I saw the error "error Unable to resolve module ./src/aws-exports from /Users/expo/workingdir/build/App.js". I did also downgrade the SDK to 46 but I don't think that was the solution.

@acidjunk
Copy link

I solved my problem by looking at the logs when the app starts on an iPhone. There I saw it tried to import something with errors (SVG related). So I removed @fortawesome/free-regular-svg-icons, @fortawesome/free-solid-svg-icons from my deps, and commented some stuff in the app that used these icons and now the EAS build works

I'm also seeing this problem and am using various @FortAwesome SVG icons in my project. I'm using them in quite a lot of places though so I haven't removed them to be able to verify this is the issue. May I ask where you saw the logs which mentioned an SVG related error? When I start my app using either expo go or a development build (both on the simulator) I don't see any errors.

I saw them in the logs on device; after trying to start the build that EAS produced. E.g. connect to the iPhone and collect logs.

@tannerabread
Copy link

tannerabread commented Feb 7, 2023

I was seeing this problem as well but seem to have found a solution. I commented out aws-exports.js in my .gitignore. I am using AWS amplify on my project. This file was not being included when uploaded to eas since it was in .gitignore. You can review your xcode log for more details - this is where I saw the error "error Unable to resolve module ./src/aws-exports from /Users/expo/workingdir/build/App.js". I did also downgrade the SDK to 46 but I don't think that was the solution.

This was it for me. Thanks @cmeyer90 !

@NewvilleMedia
Copy link

I was seeing this problem as well but seem to have found a solution. I commented out aws-exports.js in my .gitignore. I am using AWS amplify on my project. This file was not being included when uploaded to eas since it was in .gitignore. You can review your xcode log for more details - this is where I saw the error "error Unable to resolve module ./src/aws-exports from /Users/expo/workingdir/build/App.js". I did also downgrade the SDK to 46 but I don't think that was the solution.

This was it for me. Thanks @cmeyer90 !

Same @tannerabread

@marcodluz
Copy link

marcodluz commented Apr 2, 2023

I have fixed this just by deleting all files/folders related to this project inside Archives and DerivedData on:
/Users/USERNAME/Library/Developer/Xcode

Hope it helps! I took a long time to find this, I was always creating a new project and copying files over.

Good luck 👋🏽

@dtx
Copy link

dtx commented Apr 4, 2023

I was seeing this problem as well but seem to have found a solution. I commented out aws-exports.js in my .gitignore. I am using AWS amplify on my project. This file was not being included when uploaded to eas since it was in .gitignore. You can review your xcode log for more details - this is where I saw the error "error Unable to resolve module ./src/aws-exports from /Users/expo/workingdir/build/App.js". I did also downgrade the SDK to 46 but I don't think that was the solution.

I was wondering how this guy/gal saw the xocde logs, I am new to this whole thing. So I submitted the build to EAS (instead of locally building as it was failing and I didn't know how to get xcode logs, when building online it just lets you download those logs) - then I downloaded the expo logs and voila I saw the output of the script with error that was causing a failure in building main.jsbundle-

error Unable to resolve module ./src/navigation from /Users/expo/workingdir/build/App.js:

Turns out the docs mention this exact error caused by adding index.js in .gitignore like I had (https://docs.expo.dev/build-reference/troubleshooting/):

This particular error means that the app is importing ./src/Routes and it is not found. The cause could be that the filename case is different in Git than the developer's filesystem (for example, routes.js in Git instead of Routes.js), or maybe the project has a build step and it wasn't set up to run on EAS Build. In this case, it turns out that in this case ./src/Routes was intended to import ./src/Routes/index.js, but that path was accidentally excluded in the developer's .gitignore.

I removed index.js from .gitignore and local buils + remote build suceeded.

@janusdbifrons
Copy link

I was seeing this problem as well but seem to have found a solution. I commented out aws-exports.js in my .gitignore. I am using AWS amplify on my project. This file was not being included when uploaded to eas since it was in .gitignore. You can review your xcode log for more details - this is where I saw the error "error Unable to resolve module ./src/aws-exports from /Users/expo/workingdir/build/App.js". I did also downgrade the SDK to 46 but I don't think that was the solution.

This worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests