这两天执行 npm install 时会报错误:
npm ERR! Unexpected end of JSON input while parsing near
这个错误的解决方法有以下几种:
1. 删掉 package.lock.json
2. 清除 cache
npm cache clean --force
3. 进入下面这个文件夹清除 cache
路径:C:/Users/PC/AppData/Roaming/npm-cache
执行:
npm cache clean --force
4. 不要用淘宝镜像。
npm set registry https://registry.npmjs.org/
其实我也没搞懂到底是什么问题造成的,有大神给解释一下?
参考资料:https://github.com/vuejs-temp…
https://segmentfault.com/a/1190000015646531