提问者:小点点

npm错误! 运行npm install-g@angular/cli时,解析“…ain”:“src/index.js”“附近的JSON输入意外结束


当我运行命令npm install-g@angular/cli时,出现了上述错误。完整的日志如下所示

verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...ain" : "src/index.js"'
78 verbose stack at JSON.parse (<anonymous>)
78 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
78 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50
78 verbose stack at processTicksAndRejections (internal/process/task_queues.js:97:5)
79 verbose cwd C:\Users\E079233\Coinnov\CoInnovUI
80 verbose Windows_NT 10.0.17763
81 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "@angular/cli"
82 verbose node v12.18.2
83 verbose npm v6.14.5
84 error Unexpected end of JSON input while parsing near '...ain" : "src/index.js"'
85 verbose exit [ 1, true ]

我尝试了npm cache clean--force和npm install@angular/cli@latest,但没有工作

请建议解决此问题的可能方法。


共1个答案

匿名用户

您似乎看到了一些问题,因为npm

请试用::

NPM缓存清除--强制

NPM I-G NPM

npm i-g@angular/cli@latest

NPM iNPM install两者相同。 请不要迷惑