首页 文章

错误在'…ge-2.2.1.tgz“},”engin'附近解析时出现意外的JSON输入结束

提问于
浏览
3

命令:

npm install -g @angular/cli@latest

例外:

详细堆栈语法错误:在'... ge-2.2.1.tgz“}附近解析JSON输入时出现意外结束,”在jSON.parse()中运行'169详细堆栈'在parseJson处于169详细堆栈(C:\ Program Files) \ nodejs \ node_modules \ npm \ node_modules \ pacote \ node_modules \ make-fetch-happen \ node_modules \ node-fetch-npm \ node_modules \ json-parse-better-errors \ index.js:7:17)169详细消息堆栈在consumeBody .call.then.buffer(C:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ pacote \ node_modules \ make-fetch-happen \ node_modules \ node-fetch-npm \ src \ body.js:96:50)169在process._tickCallback处于169详细堆栈的详细堆栈(internal / process / next_tick.js:188:7)


寻求帮助和支持 . 谢谢

4 回答

  • 1
    npm cache clean --force
    

    然后 :

    npm install -g @angular/cli
    

    如果不工作:

    删除 package.lock.json 文件,然后重试

  • 4

    升级 npm 包后,我开始面临这个问题 .

    您可以使用以下方法解决此问题: npm cache clean --force

    瞧,重新安装包 .

  • 0

    好奇这个错误是怎么发生的,看看我的回答,这很好地解释了https://stackoverflow.com/a/52249619/7668448

    你会很快明白的 . 我放了一些漂亮的图片来说明这件事 . 希望这很有帮助 .

  • 0

    为了防止其他人在这里结束并且上述答案对他们不起作用,我发现在经过几个小时的摆弄后,将我的npm从版本5降级到版本4就可以了:

    npm install -g npm@4
    

    之后我关闭了我的CMD并再次打开它,并能够使用正常命令安装Angular CLI:

    npm install -g @angular/cli
    

    希望这有助于一路上的人,欢呼!

相关问题