今天更换了Hexo的主题,并且升级了部分依赖,在Windows都已经调试完成,但是晚上回家合并到mac上后,执行npm install时提示如下错误:

1
2
3
4
5
6
7
npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected]
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'js-yaml-js-types'
npm ERR! notarget

试过了删除node_modules,重新安装,执行npm cache clean --force,执行npm install --force等方式依旧还会有这个问题。

解决办法

1
2
3
4
5
6
7
8
# 先删除package-lock.json
rm -f package-lock.json

# 清理缓存
npm cache clean --force

# 安装
npm install