注册一个账号,填入账号,秘密,邮箱,邮箱会发邮件验证
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.
出现原因:包名重复
解决方法:修改包名