npm publish一个包

 

 

1、登录:https://www.npmjs.com/

注册一个账号,填入账号,秘密,邮箱,邮箱会发邮件验证

2、本地创建项目

3、npm adduser  

4、执行 npm publish

 

 

 期间报错:

ERR! code ENEEDAUTH
npm ERR! need auth auth required for publishing
npm ERR! need auth You need to authorize this machine using `npm adduser`

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/lifang10/.npm/_logs/2021-02-02T11_52_24_306Z-debug.log

执行npm adduser

 

 

npm ERR! publish Failed PUT 403
npm ERR! code E403
npm ERR! [no_perms] Private mode enable, only admin can publish this module [no_perms] Private mode enable, only admin can publish this module: lifang-context-demo

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/lifang10/.npm/_logs/2021-02-02T11_46_48_320Z-debug.log

出现原因:使用的是淘宝源cnpm,登陆到的是cnpm

解决方法:切换到npmjs的网址,代码如下

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

 

 

npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/myframework - You do not have permission to publish "myframework". Are you logged in as the correct user?
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.
 出现原因:包名重复

解决方法:修改包名

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值