鍍金池/ 問答/Linux  HTML/ 當執(zhí)行npm publish 時,出現unauthorized 和 is not

當執(zhí)行npm publish 時,出現unauthorized 和 is not in the npm registry

當執(zhí)行npm publish,發(fā)生了如下錯誤:

appledeMacBook-Pro:nini-react apple$ npm publish
npm ERR! publish Failed PUT 401
npm ERR! code E401
npm ERR! 404 unauthorized Login first: nini-react
npm ERR! 404
npm ERR! 404  'nini-react' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/apple/.npm/_logs/2018-02-04T00_32_35_475Z-debug.log
appledeMacBook-Pro:nini-react apple$ 

起先以為是賬戶的問題,我就執(zhí)行了npm adduser 和 npm login 都不行。公司的電腦都是可以的!哪位大神幫幫忙!

回答
編輯回答
背叛者

我為了發(fā)布一個包折騰了好久,非常感謝,已經可以了

2017年2月19日 08:30
編輯回答
我甘愿

看下是不是你配置了源,比如為了加速使用了淘寶的鏡像

2018年2月26日 23:11
編輯回答
怣人

謝邀!
您首先執(zhí)行下 npm adduser ,輸入您相應的 Username 、 Password 、 Email: (this IS public) ,關鍵的一步來了!

Logged in as 您的Username on https://registry.npmjs.org/.

如果 on 后面不是 https://registry.npmjs.org/ ,而是其他的鏡像,比如我們大家常見的淘寶鏡像:

http://registry.npm.taobao.org/

那么您首先替換成原來的,替換成原來執(zhí)行如下命令:

npm config set registry https://registry.npmjs.org/

最后,替換完畢再執(zhí)行 npm adduser npm publish ,這樣應該就ok了!

2017年11月18日 14:42