Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager
今天在npm install安装依赖包的时候报错
解决方案一:
- npm指令清除npm缓存 npm cache clean --force
- 删除node_module包
解决方案二:
- npm config ls -l 查看.npmrc的
- registry=https://registry.npmjs.org/ //修改成这个默认配置的仓库镜像地址
附上常用配置
proxy / https-proxy :指定npm使用代理
registry 指定npm下载安装包的源 默认:https://registry.npmjs.org/
npm config set prefix $dir
npm config set 进行配置项修改,使用命令配置后会把配置文件中的注释全部删除。
例如: 可以通过npm config get proxy
查看你是否设置了npm 的代理。
通过npm config set registry https://registry.npm.taobao.org
改成更快的淘宝源,解决出现安装不了模块或者速度慢的问题。