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

后端 未结 8 1459
遇见更好的自我
遇见更好的自我 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
    

提交回复
热议问题