react-native-vector-icons: Import fails with "Failed to execute 'ImportScripts' on 'WorkerGlobalScope'"

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?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18

Most upvoted comments

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

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 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.

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

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

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

yes,this success for me

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

worked for me !