简体   繁体   中英

create-react-app my-app …command not found

I ran npm install -g create-react-app and everything seemed install correctly.

I then run create-react-app my-app and in return get -bash: create-react-app: command not found

I then tried changing my ./bash_profile $PATH but yet I still get the error.

The location of all my packages is Macintosh HD/Users/my_name/npm/bin

Any help would be greatly appreciated.

Thanks!

OSX 10.13 Beta

  1. Open your current bash file: In Terminal, type: open ~/.bash_profile This will open the bash file in Text Editor

    But if you don't have a bash file, create a new one with

    touch ~/.bash_profile

  2. Add this in the file:

    export PATH=$PATH:/Users/my_name/.npm-packages/bin *be sure to change my_name to your username

  3. Restart Terminal

  4. In Terminal, run

    create-react-app my-app

Try this :

export PATH="/usr/local/bin:$PATH"

export PATH=$PATH:/Users/my_name/.npm-packages/bin/

Make sure you have given enough permission for the file path /usr/local/lib/node_modules

Then try this:

npm install -g create-react-app

After this you can create react app like

create-react-app my-app

Try running (use path to .\\bin under node modules) for ex. node_modules.bin\\create-react-app my app. The reason for this being create-react-app is not on the PATH.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM