当创建一个新的Angular 5项目时:

节点版本号:8.9.2

NPM版本:5.5.1

我的命令是:

npm install -g @angular/cli

错误是:

npm ERR! **Unexpected end of JSON input while parsing near '...nt-webpack-plugin":"0'**
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Aashitec\AppData\Roaming\npm-cache\_logs\2017-12-06T13_10_10_729Z-debug.log

错误日志在这里


当前回答

我使用Windows并删除了下面列出的所有文件,我的问题就解决了 C: \用户{{你的用户名}}\ AppData \ \ npm-cache徘徊

其他回答

在这个npm缓存清理——force之后

也许你可以挂断或等待进一步执行

我真的希望你知道你在做什么。

你也可以用这个。这就解决了我的问题。

NPM install——cache /tmp/empty-cache

我用

npm cache clean --force

然后更新NPM

npm i npm@latest -g

然后通常使用NPM安装命令

npm install 

首先卸载现有的npm包: NPM卸载-g create-react-app(如果是全局安装) 其次: NPM缓存清理——force 第三: NPM install -g create-react-app@latest并重新创建-react-app my-app。

NPM缓存清理——强制对我有用

错误解决:

$ NPM install -g gulp npm WARN已弃用gulp-util@3.0.8: gulp-util已弃用—替换它,请遵循https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5上的指导方针 npm犯错!解析JSON输入时意外结束'…/RGs88STtAtiMP3tCiNdU'

npm犯错!这个运行的完整日志可以在下面找到: npm犯错!C:\Users\admin\AppData\Roaming\ npm-cache_logs \ 2018 - 11 - 20 - t07_38_56_733z debug.log

以管理员身份打开windows PowerShell或CMD

npm cache clean --force
npm install -g @angular/cli

如果这行不通,试试下面的方法

npm cache clean --force
npm update
npm install -g @angular/cli