处理npm publish报错问题

上传项目到npm-->为社会做贡献

  1. 首先你得有一个项目
  2. npm init 生成package.json 来设置相信息
  3. 注册登录npm:npm adduser 输入你的一些信息
  4. 查看当前npm登录人 npm whoami
  5. npm publish
    出现问题:
192:react-native-native xieyusheng$ npm publish
npm 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/xieyusheng/.npm/_logs/2018-05-12T14_20_31_543Z-debug.log. 

解决:

您首先执行下 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/
那么您首先替换成原来的,替换成原来执行如下命令:

npm config set registry https://registry.npmjs.org/
最后,替换完毕再执行 npm adduser 、 npm publish ,这样应该就ok了!

猜你喜欢

转载自www.cnblogs.com/allenxieyusheng/p/9030222.html
今日推荐