我在代理后面有一个Nexus服务器,并在Nexus中激活了npm Bearer Token Realm。有3个存储库:npm(组,包括npm-private和npm-registry),npm-private(托管)和npm-registry(https://registry.npmjs.org/的代理)。配置完联系后,我想通过npm登录使用我的用户凭据登录:
npm login --registry=https://repo.company.de/repository/npm/
另外,我使用以下命令配置必要的SSL证书
:npm config set cafile /path/to/url
现在我要登录,但是出现以下错误:
npm verb adduser before first PUT { _id: 'org.couchdb.user:william',
npm verb adduser name: 'william',
npm verb adduser password: 'XXXXX',
npm verb adduser email: 'test@email.de',
npm verb adduser type: 'user',
npm verb adduser roles: [],
npm verb adduser date: '2018-11-13T12:03:03.036Z' }
npm verb request uri https://repo.company.de/repository/npm/-/user/org.couchdb.user:william
npm verb request new user, so can't send auth
npm info attempt registry request try #1 at 13:03:03
npm verb request id bcc947edff8938be
npm http request PUT https://repo.company.de/repository/npm/-/user/org.couchdb.user:william
npm info retry will retry, error on last attempt: Error: write EPROTO 140175482243968:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure:s23_clnt.c:802:
有人有小费或想法吗?我正在寻找解决方案的半天。 :(
代理有效。地址https://repo.company.de/repository/npm/可通过浏览器访问。 Nexus在docker容器中运行。我在Nginx代理日志和Nexus日志中找不到任何错误。
如果我尝试关注( http 而不是 https ):
npm login --registry=http://repo.company.de/repository/npm/
我得到a SyntaxError: Unexpected token < in JSON at position 0
,因为html代码又回来了。
npm verb bad json <html>
npm verb bad json <head><title>301 Moved Permanently</title></head>
npm verb bad json <body bgcolor="white">
npm verb bad json <center><h1>301 Moved Permanently</h1></center>
npm verb bad json <hr><center>nginx/1.15.3</center>
npm verb bad json </body>
npm verb bad json </html>
从逻辑上讲,由于建立了从http到https的转发。
答案 0 :(得分:0)
这是节点版本https://github.com/nodejs/node/issues/19359
中的错误使用node --version
找到版本。之后,我更新了Node.js,每个人都可以工作。