react-native-vector-icons icon indicating copy to clipboard operation
react-native-vector-icons copied to clipboard

Import fails with "Failed to execute 'ImportScripts' on 'WorkerGlobalScope'"

Open batjko opened this issue 6 years ago • 16 comments

I've just started a new react-native project (using the normal cli, not expo). I have installed this package using yarn:

yarn add react-native-vector-icons
react-native link

...which seemed to be successful, but when I import the package (just the import, not even using it yet), I get the following error.

e.g.:

import Icon from 'react-native-vector-icons/FontAwesome'

image

I've tried uninstalling, unlinking, re-doing the install etc... no luck. I then also tried to add that gradle line to apply the plugin, as per the README, but that didn't change anything.

Any ideas?

batjko avatar Feb 24 '18 14:02 batjko

I have same problem. For latest react-native version (0.53) , you need delete this

rm node_modules/react-native/local-cli/core/__fixtures__/files/package.json

This solved for me.

bayazetyan avatar Feb 26 '18 07:02 bayazetyan

you need delete this rm node_modules/react-native/local-cli/core/__fixtures__/files/package.json

Yes, that's what I now found out as well. I don't know if it's a bug with react-native or the vector icons one, but it's a hassle. For now, I have made the rm command (adding a -f switch) as a postinstall script in my project.

batjko avatar Feb 26 '18 08:02 batjko

 rm node_modules/react-native/local-cli/core/__fixtures__/files/package.json

yes,this success for me

MrMessy77 avatar Apr 07 '18 13:04 MrMessy77

just close debugging tab in your browser and turn off Debug JS Remotely

konstantin-mohin avatar Apr 16 '18 07:04 konstantin-mohin

For future people that come across this.

This issue occurs because you are trying to serve an offline bundle and debug it in the browser. If you used npm run build:ios to generate your bundle it probs is offline. Thus when you run react-native run-ios you your thing works. But as soon as you debug js remotely it fails because it's an offline-only bundle. So make sure you do npm start -- --reset-cache to serve a dynamically generated bundle.

ralph-dev avatar Dec 26 '19 00:12 ralph-dev

Stop your bundler and restart it. It worked for me.

naveenraju9 avatar Jan 16 '20 06:01 naveenraju9

expo 40, same issue.

RohovDmytro avatar Dec 10 '20 11:12 RohovDmytro

Hello guys, I started getting this problem after updating Expo to version 40, resetting the cache didn't work.

AndresdoSantos avatar Dec 13 '20 00:12 AndresdoSantos

expo 40 same problem

gitnasr avatar Dec 14 '20 22:12 gitnasr

My problem was a wrong import, I did it right and restarted the app, then it ran.

AndresdoSantos avatar Dec 15 '20 14:12 AndresdoSantos

This error was caused by port 19001 busy for my pc. You can find out which application is occupying the required port from Resource Monitor. This method may work for you too

hepter avatar Apr 05 '21 17:04 hepter

Stop your bundler and restart it. It worked for me.

worked for me !

saifbak avatar Jul 12 '21 15:07 saifbak

Stop your bundler and restart it. It worked for me.

Works for me!

cheng-alvin avatar Jan 28 '22 09:01 cheng-alvin

just close debugging tab in your browser and turn off Debug JS Remotely

worked for me, just close debugger on browser .

DevNomadAbhi avatar Feb 28 '22 09:02 DevNomadAbhi

hei guys,i think i found the reason. when open Debug Js Remotely, your jsbundle will executed in worker of chrome. any jsbundle runtime error will cause the 'importscripts' error. the only debugger method is check 'pause on caughted exceptions' on chrome. image

if it works for you when turn off Debug JS Remotely, like me. the reason may be calling synchronous methods on native modules.

good luck.

MecDog avatar Jun 16 '22 07:06 MecDog

For future people that come across this.

This issue occurs because you are trying to serve an offline bundle and debug it in the browser. If you used npm run build:ios to generate your bundle it probs is offline. Thus when you run react-native run-ios you your thing works. But as soon as you debug js remotely it fails because it's an offline-only bundle. So make sure you do npm start -- --reset-cache to serve a dynamically generated bundle.

I accidentally set this field to offline, and your solution reminded me of it. thank you image

terryatgithub avatar Aug 03 '22 07:08 terryatgithub

I realized i had 'react-native-maps' imported somewhere in my app, after i uninstalled it. 🥲

oluseyi-ged avatar Jul 17 '23 22:07 oluseyi-ged

See thread for fixes in particular https://github.com/oblador/react-native-vector-icons/issues/662#issuecomment-568942068

johnf avatar Aug 03 '23 05:08 johnf