React-native-vector-icons: Unable to resolve module 'react-native-vector-icons/FontAwesome'

Created on 4 Sep 2017  Â·  21Comments  Â·  Source: oblador/react-native-vector-icons

I am facing following issue when import this:

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

Error:
Unable to resolve module 'react-native-vector-icons/FontAwesome' .....

I have attached screenshots for reference. I have followed given resolution steps in error also but no luck. Please have a look and help.

Thanks
simulator screen shot sep 4 2017 7 50 29 pm

Most helpful comment

Hi, make sure that you've installed the package with yarn add react-native-vector-icons and then reset packager cache with react-native start --reset-cache

All 21 comments

Hi, make sure that you've installed the package with yarn add react-native-vector-icons and then reset packager cache with react-native start --reset-cache

@oblador Thanks for your reply. I have followed the steps given in error to resolve and it worked.

Can you please also tell me where I can see list of icons and names which I can use.

You can see a list of available icons here: https://oblador.github.io/react-native-vector-icons/

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

@oblador,
After moving to react-native 0.52 and react-native-vector-icons 4.5.0 facing this issue the Haste package 'react-native-vector-icons' #630

For now going with following solution,
rm ./node_modules/react-native/local-cli/core/fixtures/files/package.json

is it good practice or permanent solution to this issue? Will be there be any further conflicts if proceed to do so?

For latest react-native v0.53

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

@ankibalyan thanks, This solved for me.

None of these solutions are working for me. I suddenly cannot make any progress on my current progress because of this issue. Anyone have solutions other than removing the cache or removing that package.json folder?

Above issue does not resolved form me also.

I just solved this problem for myself by using:
import Icon from 'react-native-vector-icons/FontAwesome';

Instead of:
import Icon from 'react-native-vector-icons/dist/FontAwesome';

Still having this error.

import Icon from 'react-native-vector-icons/Entypo';
const phoneicon = (<Icon style={styles.label} name="phone" size={15}/>)

Gives error Error:

Unable to resolve module `@expo/vector-icons/Entypo` from `/Volumes/Untitled/projects/kono-org/app-kono/src/components/PersonView.js`: Module `@expo/vector-icons/Entypo` does not exist in the Haste module map

This might be related to https://github.com/facebook/react-native/issues/4968

I dont want to use any expo in my package. I tried using from 4.0.1 till latest and the problem stays.

I have installed react-native-vector-icons package. TO rebuild project i ran react-native link command, but that is not working.. I have also ran npm run android command but still no progress. Response of npm run android is
"npm ERR! missing script: android"
Response of react-native link is
Running react-native link without package name is deprecated and will be removed in next release. If you use this command to link your project assets, please let us know about your use case here: https://goo.gl/RKTeoc

remove the libraries

"react-native-linear-gradient": "^2.5.6",
"react-native-vector-icons": "^4.5.0",
and then Reload (cmd+R) the app

` import React from 'react';
import {View, TouchableOpacity, StyleSheet, Text} from 'react-native';
import Icon from 'react-native-vector-icons/dist/FontAwesome';
const ListItem = ({item}) => {
return(
{item.text}



);

};
const styles = StyleSheet.create({
ListItem: {
padding: 15,
backgroundColor: '#f8f8f8',
borderBottomWidth: 1,
borderColor: '#eee',
},
listItemView: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
},
listItemText: {
fontSize: 18,
}

});
export default ListItem;``

eeroe

I just solved this problem for myself by using:
import Icon from 'react-native-vector-icons/FontAwesome';

Instead of:
import Icon from 'react-native-vector-icons/dist/FontAwesome';

This was my issue as well. @rahimiarifhussain, and anyone else taking Brad's course, remove the 'dist' from the path.

Same on 7.0.0, but "fixed" after a downgrade to 6.7.0

@oblador facing the same problem with 7.0.0

This is not working

@oblador Its working 100% to me... thanks a lot.....
i run the following commands as per your instructions:

npm add react-native-vector-icons
npm --reset-cache
and then run for npm start:
npm run android-windows

Hi, make sure that you've installed the package with yarn add react-native-vector-icons and then reset packager cache with react-native start --reset-cache

I've used this solution but it was stuck still so I've done cd android then ./gradlew clean and it worked again.

Good News Thanks

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10

From: Rawan Al-Rajabinotifications@github.com
Sent: 24 November 2020 00:19
To: oblador/react-native-vector-iconsreact-native-vector-icons@noreply.github.com
Cc: Timon0305timon0305@outlook.com; Commentcomment@noreply.github.com
Subject: Re: [oblador/react-native-vector-icons] Unable to resolve module 'react-native-vector-icons/FontAwesome' (#544)

I've done

Hi, make sure that you've installed the package with yarn add react-native-vector-icons and then reset packager cache with react-native start --reset-cache

I've used this solution but it was stuck still so I've done cd android then ./gradlew clean and it worked again.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/oblador/react-native-vector-icons/issues/544#issuecomment-732266294, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AOFUW7BWUN7AX27GY67JBQTSRKDPJANCNFSM4DZP54NQ.

Was this page helpful?
0 / 5 - 0 ratings