npm 错误!解析附近时 JSON 输入意外结束 [英] npm ERR! Unexpected end of JSON input while parsing near
问题描述
在运行 npm install -g @angular/cli 后创建新的 angular 项目时,出现以下错误
when creating a new angular project after running npm install -g @angular/cli I am getting the following error
npm 错误!解析附近时 JSON 输入意外结束'...:'^2.1.0','ntypescrip'
npm ERR! Unexpected end of JSON input while parsing near '...:"^2.1.0","ntypescrip'
npm 错误!可以在以下位置找到此运行的完整日志:npm ERR!
C:\Users\Suraj\AppData\Roaming\npm-cache_logs\2019-06-28T06_04_16_049Z-debug.log软件包安装失败,见上文.
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\Suraj\AppData\Roaming\npm-cache_logs\2019-06-28T06_04_16_049Z-debug.log
Package install failed, see above.
推荐答案
Try:-
从 npm@5 开始,npm 缓存会从损坏问题中自我修复,并且保证从缓存中提取的数据是有效的.如果您想确保一切都一致,请改用npm cache verify
".如果您确定要删除整个缓存,请使用 --force 重新运行此命令.
Try:-
As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify
' instead. If you're sure you want to delete the entire cache, rerun this command with --force.
步骤 1)
$ npm cache clean --force
或
$ npm cache verify
步骤 2)
$ npm install -g @angular/cli@latest
或
尝试卸载和安装 angular/cli
步骤 3)
$ npm install --save-dev @angular/cli@latest
步骤 4)
删除node_modules
并运行$ npm install
这篇关于npm 错误!解析附近时 JSON 输入意外结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!