Home > front end >  React Native - 'react-native-asset' is not recognized
React Native - 'react-native-asset' is not recognized

Time:08-24

i'm trying to add custom font in my react-nativ-project. i added to this code

module.exports = {
    project: {
        ios: {},
        android: {}
    },
    assets: ['./assets/fonts/']
}

in to react-native.config.js and

npx react-native-asset

this hapening

'react-native-asset' is not recognized as an internal or external command,
operable program or batch file.

CodePudding user response:

First things first

Make sure your config is named react-native.config.js an that the fonts are inside MY-PROJECTS/assets/fonts

Try to re-install react-native-cli

npm install -g react-native-cli
# restart terminal, open a new one afterwards
npx react-native-asset

Try to link

Maybe running the following command will fix it if you are with an older react-native version:

npx react-native link
  • Related