nodejs安装所遇到的错误
电脑做系统后,将原来的项目重新导入到新装的idea,把nodejs和一系列的插件都安装好后,发现npm install不能正常运行,一直报以下错误。
E:\Documents\z_ui_0118>npm install
npm ERR! code ETARGET
npm ERR! notarget No matching version found for f-render@^4.12.482.
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 ‘z_ui_0118’
npm ERR! notarget
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\cyq\AppData\Roaming\npm-cache_logs\2021-07-26T06_20_27_569Z-debug.log
一开始以为是环境变量配置问题导致的,反复修改环境变量无果。
后来发现程序中有一个package-lock.json 删除,再将npm的镜像源修改为淘宝镜像,如下:
npm config set registry https://registry.npm.taobao.org
具体操作步骤如下
1、删除node_modules文件夹;
2、清除npm缓存,运行如下命令:
npm cache clean --force
//删除 package-lock.json
// mac os
rm package-lock.json
//windows os
del package-lock.json
3、执行npm install 重新安装