skip to Main Content

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.

2

Answers


  1. 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
    
    Login or Signup to reply.
  2. make sure installing react-native-asset globally before all configuration.

    after running the command npm i -g react-native-asset,in order to link your all fonts to your project, run the command npx react-native-asset.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search