在npm上发布包的记录

最近需要在npm上发布一个包,记录如下:

首先在 NPM 官网注册一个账号 或者输入命令

npm adduser

注册时会要求输入用户名,密码和邮箱。切记需要在邮件中确认。否则会造成npm publish 时出现

npm ERR! you must verify your email before publishing a new package

在npm adduser 或者 npm login 的时候,请注意看一下输入中

Logged in as <Your username> on https://registry.npmjs.org/.

是否是登录在 https://registry.npmjs.org/ 而不是其他镜像。比如淘宝镜像

Logged in as <Your username> on http://registry.npm.taobao.org/.

这样的话在发布时会提示 unauthorized


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

接下来输入命令

npm publish

即可发布成功

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值