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

Created on 24 Feb 2018  路  10Comments  路  Source: oblador/react-native-vector-icons

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?

Most helpful comment

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

All 10 comments

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.

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.

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

yes,this success for me

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.

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

expo 40, same issue.

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

expo 40 same problem

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AbhayVarshney picture AbhayVarshney  路  3Comments

jakewtaylor picture jakewtaylor  路  4Comments

lossen picture lossen  路  4Comments

reactor123 picture reactor123  路  3Comments

fevzican picture fevzican  路  3Comments