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

Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope' when using main.jsbundle on iOS simulator #6035

Closed
skizzo opened this issue Feb 19, 2016 · 18 comments
Labels
Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.

Comments

@skizzo
Copy link

skizzo commented Feb 19, 2016

Hi,
I'd like to bundle my app using the command

react-native bundle --platform ios --dev false --entry-file index.ios.js --bundle-output iOS/main.jsbundle

from my project's root directory. Bundling itself works just fine and the main.jsbundle file is created/updated. I've uncommented the line in AppDelegate.m that sets jsCodeLocation to my main bundle's URL.
As soon as I run my app in the simulator, chrome spits out the error

Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'file:///Users/steff/Library/Developer/CoreSimulator/Devices/9B63E242-5394-4781-9041-4408455B36B3/data/Containers/Bundle/Application/327E4FD3-77F7-4834-8CE7-44D68CE37B24/iazzu.app/main.jsbundle' failed to load.

When checking in Finder, the file exists and seems to have the same content than the .jsbundle file created by the bundle script.

Any ideas how I could solve this?

@wesbos
Copy link

wesbos commented Feb 24, 2016

I've got the same issue - did you figured it out?

@skizzo
Copy link
Author

skizzo commented Feb 24, 2016

Unfortunately, I did not. Was following the instructions here and I'm still getting the same error. Would be great to get some updates by the community, not being able to run my app without a node server running makes it impossible for me to deploy it to my test devices.

@wesbos
Copy link

wesbos commented Feb 24, 2016

Weird thing is that I'm able to deploy it to my device just fine, but I can't use the emulator with the bundle

@frantic
Copy link
Contributor

frantic commented Mar 5, 2016

Looks like you are trying to debug offline bundle in Chrome, which doesn't work because of browser's offline content policy. Press Cmd+D, "Disable Chrome Debugging"

@plrthink
Copy link
Contributor

plrthink commented Mar 7, 2016

Also have this issue with a refresh inited react-native@0.21 project using offline bundle.

@hirmes
Copy link

hirmes commented Jul 18, 2016

I came across this error message when trying to run via the Android emulator. Turning off the debugger and reloading the app revealed there was a syntax error in my JSX. Once that was fixed, the error went away and the app ran properly with the debugger.

@andfs
Copy link

andfs commented Jul 21, 2016

I'm not able to debug im ios. I get this error:
"Runtime is not ready for debbugging.
-Make sure Packager server is running
-Make sure the Javascript Debugger is running and not paused on a breackpoint or exception and try reloading again."

If I open the debug page in Chrome, the console show me this error:
"debuggerWorker.js:18 Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'file:///Users/Mac/Library/Developer/CoreSimulator/Devices/F222C615-DE5C-423…e/Application/5ACB48B0-8306-460E-B6CE-FF0B5B9FEDC7/parko.app/main.jsbundle' failed to load."

Any solution for this problem in ios???

@ide
Copy link
Contributor

ide commented Jul 21, 2016

The problem is that you are trying to use Chrome debugging with a JS file that is bundled with your app. You should use the packager server instead.

The Chrome debugger needs to load the JS from a server since it would be a security problem if webpages could randomly start reading files off of your disk. You can disable this security protection at your own risk with:

open /Applications/Google\ Chrome.app --args --allow-file-access-from-files

@ThaJay
Copy link

ThaJay commented Aug 29, 2016

You get this error when you have a syntax error like @hirmes said. The way to deal with this currently is to disable remote debugging, then the red screen will tell you where it is.
I will post another issue for this behaviour specifically.

@shmily617
Copy link

I am using version30 ,and now I have solved my problem by add NSURL *jsCodeLocation; [[RCTBundleURLProvider sharedSettings] setDefaults]; #if DEBUG [[RCTBundleURLProvider sharedSettings] setJsLocation:@"10.107.31.112"]; #endif before jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; in AppDelegate.m

@rnowm
Copy link

rnowm commented Sep 12, 2016

@shmily617 that works for me, thanks!

@picodoth
Copy link

picodoth commented Mar 8, 2017

@shmily617 I've been stucking for 2 days! That works like a charm! My react native version is 0.35.

@jifromz
Copy link

jifromz commented Aug 30, 2017

@shmily617 - How about running on release mode? I've stuck on that part. Any help please?

@techsin
Copy link

techsin commented Dec 20, 2017

isn't that wonderful that debugging causes errors to be more cryptic

@0xli
Copy link

0xli commented Jan 21, 2018

It happens usually when you can not access the jslocation from the Chrome on the host machine.

@0xli
Copy link

0xli commented Jan 21, 2018

Check if your Chome has proxy.

@dsouzaedison
Copy link

I came across this error when I tried to install app on my emulator. But the packager was running on a different project.

@jforaker
Copy link

Adding the &dev=true might solve it:

let jsCodeLocation = URL(string: "http://localhost:8081/index.bundle?platform=ios&dev=true")

@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests