首页 > 其他分享 >当执行npm publish 时,出现unauthorized 和 is not in the npm registry

当执行npm publish 时,出现unauthorized 和 is not in the npm registry

时间:2022-11-24 12:44:09浏览次数:34  
标签:npm unauthorized ERR publish 404 registry org

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

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
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 的方式;

 

 

 

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

也就是说,你需要重新注册才可以;
原文链接:https://blog.csdn.net/hahahhahahahha123456/article/details/82054908

标签:npm,unauthorized,ERR,publish,404,registry,org
From: https://www.cnblogs.com/nightminer/p/16921510.html

相关文章

  • 解决npm ERR! Cannot read properties of null (reading ‘pickAlgorithm‘)报错问题
    解决方法:在终端中运行命令:npmcacheclear--force然后重新运行npmi命令,再次安装安装完成,没有出现报错npmrunserve运行项目,项目可以正常启动了。  安装vueCLI......
  • npm 如何更新项目最新依赖包
    NPM是什么?Node软件包管理器(NPM)提供了各种功能来帮助你安装和维护项目的依赖关系。由于错误修复、新功能和其他更新,依赖关系可能会随着时间的推移而变得过时。你的项目......
  • npm
    npm淘宝镜像npmconfigsetregistryhttps://registry.npm.taobao.org,切换国内镜像,使用淘宝镜像npmconfiggetregistry,查看当前镜像使用的地址,返回成功,则代表设置成功......
  • [ NPM 01 ] js包管理工具 基础
    NodePackageManagernpm-v:showtheversion,ornpm--versionInthenodejsorjavaScriptworld,package.jsonisthemostimportantfile,itmanifestfil......
  • maven-publish 使用发布 andorid aar 到本地仓,项目仓或module 仓
    applyplugin:'maven-publish'println"<------${project.name}mountmavenpush-------->"/*切勿定义:groupId,artifactId,version作为变量否则导致自定义publishing......
  • C:\Users\Administrator\AppData\Roaming\npm\yarn.ps1
    C:\Users\Administrator\AppData\Roaming\npm\yarn.ps1系统上禁止运行脚本。导致此错误的原因是,PowerShell执行策略,默认设置为Restricted不加载配置文件或运行脚本。......
  • 前端工程化 - 剖析npm的包管理机制
    导读现如今,前端开发的同学已经离不开 npm 这个包管理工具,其优秀的包版本管理机制承载了整个繁荣发展的NodeJS社区,理解其内部机制非常有利于加深我们对模块开发的理解、......
  • npm install报错npm ERR! cb() never called
    1.首先我们以管理员身份打开cmd命令行窗口,执行如下清除缓存指令:npmcacheclean-f2.安装最新稳定版的Nodenpminstall-gnstable--force3.1再次执行npminstall ......
  • Why the “MAVEN2_CLASSPATH_CONTAINER will not be exported or published”
    OncertainoccasionsEclipsewillpresentyouwiththefollowingwarning:Classpathentryorg.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINERwillnotbeexport......
  • idea 如何执行npm 命令
    修改执行命令的路径:  修改: 参考: idea中执行“npm”命令,提示‘npm‘不是内部或外部命令,也不是可运行的程序 ......