zoukankan      html  css  js  c++  java
  • 当执行npm publish 时,出现unauthorized 和 is not in the npm registry

    当执行npm publish,发生了如下错误:

    1.  
      appledeMacBook-Pro:nini-react apple$ npm publish
    2.  
      npm ERR! publish Failed PUT 401
    3.  
      npm ERR! code E401
    4.  
      npm ERR! 404 unauthorized Login first: nini-react
    5.  
      npm ERR! 404
    6.  
      npm ERR! 404 'nini-react' is not in the npm registry.
    7.  
      npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
    8.  
      npm ERR! 404
    9.  
      npm ERR! 404 Note that you can also install from a
    10.  
      npm ERR! 404 tarball, folder, http url, or git url.
    11.  
       
    12.  
      npm ERR! A complete log of this run can be found in:
    13.  
      npm ERR! /Users/apple/.npm/_logs/2018-02-04T00_32_35_475Z-debug.log
    14.  
      appledeMacBook-Pro:nini-react apple$

    起先以为是账户的问题,我就执行了npm adduser 和 npm login 都不行。

    您首先执行下 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了!

    看下是不是你配置了源,比如为了加速使用了淘宝的镜像

    如果使用了淘宝镜像,先还原淘宝镜像

    1.使用 cnpm 的注意报错:

    no_perms Private mode enable, only admin can publish this module

      设置回原本的就可以了:

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

    2.npm包package.json中registory属性一定要填写,每次publish npm时package.json中version版本一定要大于上一次。

    3.npm publish failed put 500  unexpected status code 401这样的报错信息,往往是没有登录成功,操作npm login

    在使用npm的时候,免不了要注册一个用户

    注册用户有两种方式: 第一种是进入官网界面进行注册:点击进入官网

                                         第二种是:使用 npm adduser 的方式;

                                                        

                    但是使用第二种方式可能注册不一定成功,那么在后续上传个人的模块的时候就会出现如下错误:

    也就是说,你需要重新注册才可以;

  • 相关阅读:
    转傻逼是傻逼的通行证,苦逼是苦逼的墓志铭 简单
    css 表格底边框在ie6下不显示 简单
    cookie设置、读取,domain、path、expires 简单
    js事件作用域问题 简单
    js鼠标事件定位 简单
    报到证的作用 简单
    转白领一族预防空调病全攻略 简单
    The "External World" is Inside the Brain
    [转]DllMain详解
    Drill Into .NET Framework Internals to See How the CLR Creates Runtime Objects
  • 原文地址:https://www.cnblogs.com/1549983239yifeng/p/14240998.html
Copyright © 2011-2022 走看看