当前位置:网站首页>npm的nexus私服 E401 E500错误处理记录
npm的nexus私服 E401 E500错误处理记录
2022-07-25 15:06:00 【深海蓝山】
用nexus搭建的npm本地仓库,在发布时报 npm ERR! code E401,原因是没有基础权限,需要登录,用帐号登录时又报E500错误,从网上查了一下,资源比较少,而且基本重复,现把问题记录一下,以方便后期有相同问题的伙伴作参考
npm E401
npm publish 时,错误详情如下:
npm ERR! code E401
npm ERR! Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"1.npm publish
报401 BASIC realm="Sonatype Nexus Repository Manager",这个一般是 npm publish发包才会有此问题,npm publish时需要有本地仓库的权限,一般登录一下就可以解决。登录用 npm login 输入nexus上创建的用户、密码和邮箱就可以了
如果登录后还不能发,检查npm nexus的 Realms设置,把npm Bearer Token Reaim放入Active中,并保存

2.npm install
如果仅仅是npm i 的话,首先检查一下自己所用的包地址,使用nrm ls 列出当前的包,可以用 nrm use 切换

其次检查一下Nexus Repository Manager上的Anonymous是否开放

npm E500
这个问题比较奇怪,从网上没有找到相似的问题,现在尝试过程写下,不一定有代表性

首页,帐号是没有问题的,nexus访问也没有问题,就是npm login 时就500 了,
1.确认是否登录 npm whoami, 查看当前登录npm的账户,publish发布包时可以确认用户是否正确,如果正常登录就可以结束了
npm whoami2.如果登录不成功,报E500,首页检查nexus私服上的帐号密码是否有效,输入是否正确
3.确认无误,像我遇到的这种少见的私服、帐号均正常,就是登录不上的,继续进行以下尝试
检查本地项目配置文件package.json中中"publishConfig"是地址是否是正确的私服地址

4.检查本地npm默认配置项,关键是userconfig ,默认地址:c:\Users\用户\.npmrc文件,将登录信息保存在配置文件中
//列出npm的默认配置项
npm config list -l 
我的配置中原来是只有前两行,所以一直登录E500异常,虽然输入的帐号信息正确,但还是报500,后来追加了下面三行,即always-auth、_auth、email信息后,就可以正常发布了,而且直接用npm whoami 查看登录信息,竟显示登录成功后的帐号,
registry=http://10.100.xx.xx:5006/repository/npm-group/
save-prefix=~
always-auth=true
_auth="dXNlcmFkbWluOnVzZXJwYXNzd29yZA=="
[email protected]
这里说明一下:_auth="dXNlcmFkbWluOnVzZXJwYXNzd29yZA=="//这里是[帐号:密码]的Base64编码后的值,要用自己的帐号密码Base64编码后替换,到这里我的问题是解决了,可以正常npm publish了。如果你也遇到类似的问题,到这里还没有解决的话,请继续尝试解决,如果你方便的话,请把解决方案通过评论方法留言给我,谢谢。
边栏推荐
- Stored procedure bias of SQL to LINQ
- sql to linq 之存储过程偏
- oracle_ 12505 error resolution
- "How to use" observer mode
- 简易轮播图和打地鼠
- The solution to the problem that the progress bar of ros2 installation connext RMW is stuck at 13%
- BigDecimal rounds the data
- Number of high-quality number pairs [bit operation characteristics + abstract ability evaluation + grouping fast statistics]
- Reprint ---- how to read the code?
- SQL Server forcibly disconnects
猜你喜欢

SQL优化的一些建议,希望可以帮到和我一样被SQL折磨的你

冈萨雷斯 数字图像处理 第一章绪论

51 single chip microcomputer learning notes (2)

Add the jar package under lib directory to the project in idea

VS2010 add WAP mobile form template

node学习
[Android] recyclerview caching mechanism, is it really difficult to understand? What level of cache is it?

easygui使用的语法总结

"How to use" decorator mode

Syntax summary of easygui
随机推荐
C#,C/S升级更新
ES5写继承的思路
Process control (Part 1)
How to use the random number function of JMeter
oracle_12505错误解决方法
AS查看依赖关系和排除依赖关系的办法
51 single chip microcomputer learning notes (1)
IP address classification, which determines whether a network segment is a subnet supernetwork
LeetCode_ String_ Medium_ 151. Reverse the words in the string
阿里云技术专家邓青琳:云上跨可用区容灾和异地多活最佳实践
The solution to the problem that the progress bar of ros2 installation connext RMW is stuck at 13%
了解一下new的过程发生了什么
js URLEncode函数
bridge-nf-call-ip6tables is an unknown key异常处理
Stored procedure bias of SQL to LINQ
How to realize a correct double check locking
27 选择器的分类
"Ask every day" briefly talk about JMM / talk about your understanding of JMM
PHP implements non blocking (concurrent) request mode through native curl
Content type corresponding to office file