Vencovsky
Vencovsky

Reputation: 31565

Problem when linking react-native-vector-icons

I just started a new react-native project from zero, added react-native-vector-icons, but when i try to link it, I get the following, I have no idea why this is happening, I didn't change anything, it's a clen project.

error Something went wrong while linking. Error: ENOENT: no such file or directory, copyfile 'PROJECTFOLDER/node_modules/react-native-vector-icons/Fonts/AntDesign.ttf' -> 'D:\Codes\ReactNative\KosTimer\android\app\src\main\assets\fonts\AntDesign.ttf'
Please file an issue here: https://github.com/react-native-community/react-native-cli/issues
error ENOENT: no such file or directory, copyfile 'PROJECTFOLDER/node_modules/react-native-vector-icons/Fonts/AntDesign.ttf' -> 'D:\Codes\ReactNative\KosTimer\android\app\src\main\assets\fonts\AntDesign.ttf'

Because of this error, all my icons appear with a X inside a square

*PROJECTFOLDER is the place where is my project

Upvotes: 1

Views: 1646

Answers (1)

Andrew
Andrew

Reputation: 28539

The issue is caused by a missing assets/fonts folder inside the android project.

To solve the issue create an assets folder in your project.

enter image description here

Then inside that folder create a folder called fonts.

This is what should have:

<project root>/android/app/src/main/assets/fonts

If you want to do with one command, you can open a terminal at your project root and type:

For mac:

mkdir -p ./android/app/src/main/assets/fonts

For windows:

mkdir ./android/app/src/main/assets/fonts

Then you should be able to link the dependency as normal.

Upvotes: 7

Related Questions