当前位置:网站首页>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了。如果你也遇到类似的问题,到这里还没有解决的话,请继续尝试解决,如果你方便的话,请把解决方案通过评论方法留言给我,谢谢。
边栏推荐
- LeetCode_ Factorization_ Simple_ 263. Ugly number
- 37 element mode (inline element, block element, inline block element)
- BigDecimal rounds the data
- About RDBMS and non RDBMS [database system]
- VS2010 add WAP mobile form template
- "How to use" decorator mode
- 35 快速格式化代码
- 【微信小程序】小程序宿主环境详解
- Leetcode-198- house raiding
- API health status self inspection
猜你喜欢

Process control (Part 1)

As methods for viewing and excluding dependencies

Nacos2.1.0 cluster construction

Implement a simple restful API server

006操作符简介

SPI传输出现数据与时钟不匹配延后问题分析与解决

Splice a field of the list set into a single string

37 element mode (inline element, block element, inline block element)

I hope some suggestions on SQL optimization can help you who are tortured by SQL like me

51 single chip microcomputer learning notes (1)
随机推荐
pkg_ Resources dynamic loading plug-in
How to use the random number function of JMeter
Automatically set the template for VS2010 and add header comments
When using jetty to run items, an error is reported: form too large or form too many keys
防抖(debounce)和节流(throttle)
Raft of distributed consistency protocol
Implementation of redis distributed lock
流程控制(上)
MySQL sort
转载----如何阅读代码?
L1和L2正则化
[C topic] force buckle 876. Intermediate node of linked list
VS2010 add WAP mobile form template
QT connect, signal, slot and lambda comparison
Deployment and simple use of PostgreSQL learning
sql to linq 之存储过程偏
云安全技术发展综述
解决asp.net上传文件时文件太大导致的错误
Share a department design method that avoids recursion
瀑布流布局