How should I set _auth in .npmrc when using a Nexus https npm registry proxy? -


context

  1. my .npmrc file seems correctly read (checked npm config ls -l both command line , maven build).

  2. the machine on npm run cannot connect directly net, can connect nexus npm registry url. therefore, proxy properties proxy , https-proxy not set.

  3. as access nexus restricted, have generated access token within nexus.

  4. nexus security tokens made username , password both contain characters such / have "url encoded"

  5. as expected, configuration, when running npm install detects no proxy.

  6. nexus npm registry proxy seems correctly set (i can both access json files , download tgz files using web browser after having connected using token generated)

  7. if set registry http://registry.npmjs.org/ , comment _auth, email, always-auth, strict-ssl properties, , add proxy , 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

  1. base64encode(<username>:<password>)
    • results in npm info retry retry, error on last attempt: error: socket hang up
  2. base64encode(urlencode(<username>:<password>))
    • results in npm info retry retry, error on last attempt: error: request requires auth credentials. run `npm login` , repeat request.
  3. base64encode(urlencode(<username>):urlencode(<password>))
    • results in npm info retry retry, error on last attempt: error: socket hang up

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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -