create-react-app, installation error (“command not found”)

后端 未结 8 1376
遇见更好的自我
遇见更好的自我 2020-12-08 07:09

I have installed create-react-app exactly as instructed on the facebook instruction page (https://facebook.github.io/react/blog/2016/07/22/create-apps-with-no-configuration.

相关标签:
8条回答
  • 2020-12-08 07:51

    Answers given above are right but I want to share some things that I also faced and these are basics.

    To setup react project

    If you want to create a node environment

    $ sudo apt-get update
    $ sudo apt-get install nodejs
    

    (Sometimes we can also run without sudo; but sudo means install in system level.)

    $ sudo apt-get install nodeenv
    
    $ nodeenv env
    $ source /bin/activate
    

    If you want to create new react app then

    $ npm install create-react-app
    

    If an error occurs create-react-app: command not found then install with -g, it happens because node is installed globally and it is not getting the node in local

    $ npm install -g create-react-app
    
    $ create-react-app app_name
    $ cd app_name
    app_name$ npm start
    
    0 讨论(0)
  • 2020-12-08 07:53

    Try this. It worked or me. I found this in the React documentation. "Npx" is not a typo. It's a package runner tool that comes with npm 5.2+.

    npx create-react-app my-app

    0 讨论(0)
提交回复
热议问题