vue安装脚手架 Unexpected end of JSON input while parsing near '...sTbtjnjIcgi U7iVktNJE'

没办法安装上,一直报错

今天尝试一些安装vue脚手架做项目,然后一直报错

Unexpected end of JSON input while parsing near '...61SUX9hxFtXXQwLEROcL'

Unexpected end of JSON input while parsing near '...al-exit":"^3.0.0","st'

npm ERR! Unexpected end of JSON input while parsing near '...0"},"_hasShrinkwrap":'

npm ERR! A complete log of this run can be found in:

npm ERR! /home/jane/.npm/_logs/2018-06-09T06_14_46_082Z-debug.log

解决办法

npm代理为淘宝的代理的时候就会发生这样的错误,将npm代理换回来就不报错了,具体原因不详,但是亲证可行(修改代理)

npm config set registry http://registry.cnpmjs.org

第二种办法

npm config set registry“ http://registry.npmjs.org

试过的办法

1-清除缓存(不行)

npm cache clean --force

2-重新安装(不行)

npm uninstall -g vue

npm uninstall -g vue-cli

npm uninstall -g @vue/cli

npm cache clean --force

npm install -g vue

npm install -g @vue/cli

3-更新npm版本(不行)

npm install npm@latest -g(更新到最新版本)

链接:https://www.jianshu.com/p/e7828f5ae99a

来源:简书

著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。