I can't install react using npx create-react-app?

后端 未结 15 995
渐次进展
渐次进展 2020-12-29 06:15

I am trying to use npx create-react app but i have errors that is shown below:

npm ERR! Unexpected end of Json input w         


        
相关标签:
15条回答
  • 2020-12-29 06:50

    I had the same issue "Install for create-react-app@latest failed with code 7" Use this. It worked for me.

    npm install -g create-react-app    
    npx create-react-app my-app     
    cd my-app      
    npm start     
    

    for further reference go to: https://www.techomoro.com/how-to-install-and-setup-a-react-app-on-windows-10/

    0 讨论(0)
  • 2020-12-29 06:55

    If you are unable to create the app try reinstalling nodeJS in 32-bits and try it.

    0 讨论(0)
  • 2020-12-29 06:57

    To fix the issue, run these commands in sequence

    npm init
    npm install create-react-app
    npx create-react-app myapp
    
    0 讨论(0)
  • 2020-12-29 06:57

    I had the same problem in creating react project when I used commands from official source https://reactjs.org/docs/create-a-new-react-app.html#create-react-app

    npx create-react-app my-app
    cd my-app
    npm start
    

    The above commands din't work on my windows. I have Node >= 6 and npm >= 5.2 on my machine even then it is not able to open localhost:3000 then I used this commands

    npm install -g create-react-app
    create-react-app my-app-name
    cd my-app-name
    npm start
    

    It worked perfectly fine. I learned from https://www.youtube.com/watch?v=pCgDRgmfilE

    0 讨论(0)
  • 2020-12-29 06:58

    Clean npm cache:

    npm cache clean --force
    

    then try again

    0 讨论(0)
  • 2020-12-29 06:58

    Sometime it happens because of slow internet speed. Try with this one.

     npx create-react-app <app name> -timeout=60000
    

    Default timeout=30000(30sec). increase timeout, if you necessary.

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