npm的常见问题及配置

发布时间 2023-03-22 21:13:29作者: study_php_java

运行npm install遇到问题:

No matching version found for ts-transformer-properties-rename@~0.14.0

运行 npm search ts-transformer-properties-rename 也报错404

应该就是配置镜像的问题,之前用的是淘宝镜像,需要删除该镜像

1、恢复默认镜像地址 删除会恢复默认镜像
npm config delete registry

npm缓存问题。需要清空缓存再安装依赖

npm cache clean -f

2、获取配置镜像地址
npm get registry

npm config get registry

3、全局配置淘宝镜像地址, 如果需要恢复淘宝镜像,可以这样
npm config set registry https://registry.npm.taobao.org --global

 

再次运行npm install就正常了