2024-07-15 npm ERR! 403 403 Forbidden - PUT https://registry.npmmirror.com/-/user/org.couchdb.user:iuniko - [FORBIDDEN] Public registration is not allowed ==> 切换npm镜像源
今天晚上我打算推一个包到npm时,遇到了如下报错:
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.
原因:npm镜像源不是官方镜像源。ps:其实我瞎猜的,但是切换了镜像源就ok了,我之前是淘宝镜像源。
解决方案:打开终端,输入一下命令:
npm config set registry https://registry.npmjs.org/
再次npm login,啪啦啪啦输入信息,哎,ok了~
附npm查看镜像源命令
npm config get registry