一、问题描述:
今天在npm登陆上提示报错信息npm login发布包时需要登录,假如修改过国内镜像的小伙伴会出现npm ERR! 403 403 Forbidden - PUT https://registry.npmmirror.com/-/user/org.couchdb.user:xxx - [FORBIDDEN]
Public registration is not allowed
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy, or
npm ERR! 403 on a server you do not have access to.
二、问题解决:
分析:地址存在明显问题,那是设置过国内淘宝镜像的地址
解决核心:找到.npmrc
文件,删除registry(或更改成正确的地址)
- 方式一:该文件默认位置为当前用户下,也可通过
npm config list
获取到配置文件的详细信息,打开删除对应属性即可
- 方式二:
通过命令npm config delete registry
删除
通过命令npm config set registry https://registry.npmjs.org/
- 补充:
淘宝镜像设置:npm config set registry https://registry.npm.taobao.org
之前再次执行npm login
试试