NPM Install Error:Unexpected end of JSON input while parsing near '…nt-webpack-plugin“:”0'

前端 未结 30 1922
孤街浪徒
孤街浪徒 2020-11-22 10:20

When Creating a new Angular 5 project:

node version: 8.9.2

npm version: 5.5.1

My Command is

npm install -g @angular/cli
相关标签:
30条回答
  • 2020-11-22 10:59

    This happens something due to cache or outdated version of Node Package Manager i just updated my NPM it works fine here is command to update Npm to latest version

    npm i npm@latest -g
    

    after updating NPM run your desired command

    0 讨论(0)
  • 2020-11-22 11:01

    Npm uses Cache for downloading new packages for you. You need to clear your npm cache. use following command to clean :

    npm cache clean --force
    

    then normally use your npm install command e.g.

    npm install -g @angular/cli
    
    0 讨论(0)
  • 2020-11-22 11:02

    delete npm and npm-cache folders in C:\Users\admin\AppData\Roaming\ (windows) then execute cmd

    npm cache clear --force

    npm cache verify

    update npm to latest version

    npm i -g npm

    then create your project 1)Angular

    npm i -g @angular/cli@latest

    ng new HelloWorld

    2)React

    npm i -g create-react-app

    create-react-app react-app

    0 讨论(0)
  • 2020-11-22 11:03

    If

    npm cache clean --force
    

    doesn't work. try

    npm cache clean --force
    npm update
    
    0 讨论(0)
  • 2020-11-22 11:03

    You can use yarn package manager instead of npm.

    It solved this problem for me

    0 讨论(0)
  • 2020-11-22 11:04

    I've faced this issue and I tried all the answers on Stackoverflow but not worked for me, finally I found solution for this issue:

    • First of all you have to uninstall nodejs and remove all the files related him
    • Go to "Register Editor" and search for all "nodejs", "node.js" and delete them
    • Restart your computer
    • And reinstall nodejs then install angular.

    It's worked for me

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