记录所遇到过的各种有关npm
的问题及其解决方法。
解决npm ERROR! Unexpected end of JSON input while parsing near
1 | npm ERR! Unexpected end of JSON input while parsing near |
这个错误的解决方法有以下几种:
1.删掉package.lock.json
2.清除cache
1 | npm cache clean --force |
3.进入下面这个文件夹清除cache
路径:C:/Users/PC/AppData/Roaming/npm-cache
执行:
1 | npm cache clean --force |
4.不要用淘宝镜像
1 | npm set registry https://registry.npmjs.org/ |
解决WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\fsevents):
在安装hexo-deployer-git
过程中出现以下问题
1 | npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\fsevents): |
fsevent的作用是能够检测文件目录的修改,可以记录恶意软件的非法操作,获取恶意软件的完整路径,删除和修改日期。
原因:fsevent是mac系统的可选依赖,在win或者Linux下使用了,会有警告。在windows上环境下可以忽略,也可以删除fsevent文件夹。