首页 文章

NPM安装错误:在'…nt-webpack-plugin“:”0'附近解析时意外结束JSON输入

提问于
浏览
31

创建新的Angular 5项目:

节点版本:8.9.2

npm版本:5.5.1

我的命令是 'npm install -g @angular/cli'

错误是

错误的ERR! Unexpected end of JSON input while parsing near '...nt-webpack-plugin":"0'

错误的ERR!可以在以下位置找到此运行的完整日志:C:\ Users \ Aashitec \ AppData \ Roaming \ npm-cache_logs \ 2017-12-06T13_10_10_729Z-debug.log

错误日志是http://www.aashitechno.in/2017-12-06T13_10_10_729Z-debug.log

9 回答

  • 0

    这解决了我

    npm cache clean --force

    然后运行

    npm install -g @ angular / cli @ latest

  • 0

    解:

    npm cache clean --force
    

    然后再次尝试创建您的应用程序(在创建反应应用程序时)或安装您要安装的内容 .

    create-react-app myproject
    

    (创建反应应用程序)[在不同操作中可能发生的相同npm问题]

    npm install -g @angular/cli@latest
    

    (安装角度cli(或安装任何其他))

    它会工作 .

    说明:

    那个's a problem related to npm, it'是关于腐败的缓存 . 尽管在较新版本的npm中他们实现了自我修复,这通常可以保证没有腐败,但它似乎并不那么有效 .
    enter image description here
    强制干净缓存解决问题 .

    解析其中一个具有json格式的缓存文件时发生错误 . 缓存位于〜/ .npm / _cacache(在linux中)和%AppData%/ npm-cache(windows)中 . 对于我当前的npm版本,当我检查时,有三个目录 .

    enter image description here

    如果你检查第一个或第二个,结构如下
    enter image description here

    并且每个缓存文件都有一个json格式(以及解析的内容)
    enter image description here

    这里有一个很好的链接来自doc:https://docs.npmjs.com/cli/cache

    [更新]此外,如果它没有解决它,你可以在这里检查这个答案https://stackoverflow.com/a/50191315/7668448它显示如何更改npm注册表,这可能会有所帮助 . 检查一下 .

  • 2

    Npm使用Cache为您下载新包 . 您需要清除您的npm缓存 . 使用以下命令清理:

    npm cache clean --force
    

    然后通常使用你的npm install命令,例如

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

    然后

    npm install -g @angular/cli
    

    为我工作

  • 78

    这解决了它npm cache clean --force

  • 12

    如果

    npm cache clean --force
    

    不起作用试试

    npm cache clean --force
    npm update
    
  • 2

    我解决了这个问题

    npm cache clean --force
    

    然后更新npm

    npm i npm@latest -g
    

    然后通常使用你的npm install命令

    npm install
    
  • 2

    这是你的npm的错误....

    所以unistall节点再次安装它 .

    有用....

    PS:再次安装节点后,全局安装angular cli .

    npm install -g @angular/cli@latest
    
  • 0

    npm cache clean --force为我工作

    错误已解决:

    $ npm install -g gulp npm WARN弃用了gulp-util@3.0.8:gulp-util已弃用 - 请按照https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5 npm ERR的指导进行替换!解析'.../RGs88STtAtiMP3tCiNdU'附近的JSON输入意外结束

    错误的ERR!可以在以下位置找到此运行的完整日志:npm ERR! C:\用户\ ADMIN \应用程序数据\漫游\ NPM-cache_logs \ 2018-11-20T07_38_56_733Z-的debug.log

相关问题