How should I set _auth in .npmrc when using a Nexus https npm registry proxy? -
context
my
.npmrc
file seems correctly read (checkednpm config ls -l
both command line , maven build).the machine on
npm
run cannot connect directly net, can connect nexus npm registry url. therefore, proxy propertiesproxy
,https-proxy
not set.as access nexus restricted, have generated access token within nexus.
nexus security tokens made username , password both contain characters such
/
have "url encoded"as expected, configuration, when running
npm install
detects no proxy.nexus npm registry proxy seems correctly set (i can both access
json
files , downloadtgz
files using web browser after having connected using token generated)if set
registry
http://registry.npmjs.org/
, comment_auth
,email
,always-auth
,strict-ssl
properties, , addproxy
,https-proxy
configuration,npm install
works expected (but won't able on target environment)
content of .npmrc
file
; nexus proxy registry pointing http://registry.npmjs.org/ registry = https://<host>/nexus/content/repositories/npmjs-registry/ ; base64 encoded authentication token _auth = <see question below> ; required nexus email = <valid email> ; force auth used requests always-auth = true ; don't want put certificates in .npmrc strict-ssl = false loglevel = silly
question
how should generate _auth
property in order have npm install
work expected?
i tried far
- base64encode(
<username>:<password>
)- results in
npm info retry retry, error on last attempt: error: socket hang up
- results in
- base64encode(urlencode(
<username>:<password>
))- results in
npm info retry retry, error on last attempt: error: request requires auth credentials. run `npm login` , repeat request.
- results in
- base64encode(urlencode(
<username>
):
urlencode(<password>
))- results in
npm info retry retry, error on last attempt: error: socket hang up
- results in
when getting socket hang up
error have following stack trace:
http request https://<host>/nexus/content/repositories/npmjs-registry/fsevents sill fetchpackagemetadata error: socket hang sill fetchpackagemetadata @ tlssocket.onhangup (_tls_wrap.js:1035:19) sill fetchpackagemetadata @ tlssocket.g (events.js:260:16) sill fetchpackagemetadata @ emitnone (events.js:72:20) sill fetchpackagemetadata @ tlssocket.emit (events.js:166:7) sill fetchpackagemetadata @ endreadablent (_stream_readable.js:905:12) sill fetchpackagemetadata @ dontcallback2 (node.js:441:9) sill fetchpackagemetadata @ process._tickcallback (node.js:355:17) sill fetchpackagemetadata error fsevents@^1.0.0 { [error: socket hang up] code: 'econnreset' } warn install couldn't install optional dependency: socket hang verb install error: socket hang verb install @ tlssocket.onhangup (_tls_wrap.js:1035:19) verb install @ tlssocket.g (events.js:260:16) verb install @ emitnone (events.js:72:20) verb install @ tlssocket.emit (events.js:166:7) verb install @ endreadablent (_stream_readable.js:905:12) verb install @ dontcallback2 (node.js:441:9) verb install @ process._tickcallback (node.js:355:17)
when getting this request requires auth credentials
error have following stack trace:
npm sill fetchpackagemetadata error: request requires auth credentials. run `npm login` , repeat request. npm sill fetchpackagemetadata @ cachingregistryclient.authify (<root>\ui\target\node\node_modules\npm\node_modules\npm-registry-client\lib\authify.js:17:14) npm sill fetchpackagemetadata @ cachingregistryclient.makerequest (<root>\ui\target\node\node_modules\npm\node_modules\npm-registry-client\lib\request.js:103:17) npm sill fetchpackagemetadata @ <root>\ui\target\node\node_modules\npm\node_modules\npm-registry-client\lib\request.js:66:17 npm sill fetchpackagemetadata @ retryoperation._fn (<root>\ui\target\node\node_modules\npm\node_modules\npm-registry-client\lib\attempt.js:18:5) npm sill fetchpackagemetadata @ null._ontimeout (<root>\ui\target\node\node_modules\npm\node_modules\retry\lib\retry_operation.js:49:10) npm sill fetchpackagemetadata @ timer.listontimeout (timers.js:92:15) npm sill fetchpackagemetadata error fsevents@^1.0.0 [error: request requires auth credentials. run `npm login` , repeat request.] npm warn install couldn't install optional dependency: request requires auth credentials. run `npm login` , repeat request. npm verb install error: request requires auth credentials. run `npm login` , repeat request. npm verb install @ cachingregistryclient.authify (<root>\ui\target\node\node_modules\npm\node_modules\npm-registry-client\lib\authify.js:17:14) npm verb install @ cachingregistryclient.makerequest (<root>\ui\target\node\node_modules\npm\node_modules\npm-registry-client\lib\request.js:103:17) npm verb install @ <root>\ui\target\node\node_modules\npm\node_modules\npm-registry-client\lib\request.js:66:17 npm verb install @ retryoperation._fn (<root>\ui\target\node\node_modules\npm\node_modules\npm-registry-client\lib\attempt.js:18:5) npm verb install @ null._ontimeout (<root>\ui\target\node\node_modules\npm\node_modules\retry\lib\retry_operation.js:49:10) npm verb install @ timer.listontimeout (timers.js:92:15)
thanks in advance.
https://books.sonatype.com/nexus-book/reference/npm-deploying-packages.html
$ echo -n 'admin:admin123' | openssl base64
Comments
Post a Comment