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

前端 未结 30 2339
孤街浪徒
孤街浪徒 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 11:10

    If npm cache clean --force doesn't resolve the issue, try deleting the ~/.npm directory (*nix/macOS). This is the directory where node stores its cache, locks, logs, global packages (unless you're using nvm), and modules installed via npx.

    First, backup your current ~./npm directory:

    mv ~/.npm ~/.npm-backup
    

    Now try running your npm command again. This will create a new ~/.npm directory. If the issue is resolved, you can safely remove you backup. Before doing so, you may want to review the global packages installed in your ~/.npm-backup directory so you can reinstall them using npm i -g [package].

    rm -rf ~/.npm-backup
    

    If the issue is not resolved, you can restore your backup:

    rm -rf ~/.npm
    mv ~/.npm-backup ~/.npm
    

    Careful with those rm commands, folks!

提交回复
热议问题