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

后端 未结 15 997
渐次进展
渐次进展 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 07:05

    The problem arises due to so many reasons.

      1. This happens is if one of the node modules requires to install your react app is missing.
      1. The other reason is if your have and unstable network connection.
      1. Sometimes, but on rare cases, your antivirus may assume the cmd files in your cache to be malware.

    if your antivirus is your issue, disable it for the period you run the commands.

    Whatever the reason for npx create-react-app is not working on your machine, run the following commands in sequence:

    npm cache clean --force 
    npx create-react-app my-app  
    

    let me know if this worked for you

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

    First, clear cache by typing this in your terminal:

    npm cache clean --force
    

    Then upgrade your version of npm by either following these steps or type:

    npm install -g npm@next
    

    Now go to "NodeJS" in Programs and Features in your Windows settings and Repair your installation.

    Restart terminal and type:

    npx create-react-app my-app
    

    This should hopefully fix your issue.

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

    Run Windows PowerShell as administrator and type this:

    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

    0 讨论(0)
  • 2020-12-29 07:06
    1. In your antivirus whitelist the node software

    2. hey guys in my point of view, check your system any antivirus is running and blocking the node.exe more specifically (ByteFence Anti-malware)

    3. In my case its blocking the node system call

    4. I quit this from hidden icons in the system tray it works fine for me

    when you do

    npm start

    • sometimes you may seen some antivirus asks permission to add it to whitelist or add it to block list that antivirus you should stop or add whitelist to it

    0 讨论(0)
  • 2020-12-29 07:07

    This worked for me!!

    first you need to create the package.json file by npm init

    then npx create-react-app myapp

    0 讨论(0)
  • 2020-12-29 07:09
    1. sudo chown -R 1000:1000 "/home/aditya/.npm"
    2. npx crate-react-app

    this should fix the issue.

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