KontextWie sollte ich _auth in .npmrc setzen, wenn ich einen Nexus https npm Registry Proxy verwende?
Meine
.npmrc
Datei scheint richtig gelesen (mitnpm config ls -l
sowohl von der Kommandozeile und von Maven Build-geprüft) werden.der Computer, auf dem
npm
ausgeführt wird, kann nicht direkt mit dem Netz verbinden, es kann nur eine Nexus npm Registrierung URL verbinden. Daher werden Proxy-Eigenschaftenproxy
undhttps-proxy
nicht festgelegt.Da der Zugriff auf Nexus eingeschränkt ist, habe ich aus Nexus ein Zugriffstoken generiert.
Nexus Sicherheitstoken aus einem Benutzername gemacht und ein Passwort, die beiden Zeichen wie
/
enthalten, die haben in der Regel „URL-kodiert“wie erwartet sein, mit dieser Konfiguration, wenn
npm install
läuft keinen Proxy erkennt .Nexus npm Registry-Proxy scheint richtig eingestellt werden (kann ich beide Zugang
json
Dateien und downloadentgz
Dateien einen Web-Browser nach der Verwendung der generierten Token verbunden ist)Wenn ich
registry
-http://registry.npmjs.org/
und Kommentar gesetzt_auth
,email
,always-auth
,strict-ssl
Eigenschaften und fügenproxy
undhttps-proxy
Konfigurationnpm install
wie erwartet funktioniert (aber ich werde es nicht auf Zielumgebung tun können)
Inhalt des .npmrc
Datei
; Nexus proxy registry pointing to http://registry.npmjs.org/
registry = https://<host>/nexus/content/repositories/npmjs-registry/
; base64 encoded authentication token
_auth = <see question below>
; required by Nexus
email = <valid email>
; force auth to be used for GET requests
always-auth = true
; we don't want to put certificates in .npmrc
strict-ssl = false
loglevel = silly
Frage
Wie soll ich die _auth
Eigenschaft richtig erzeugen, um npm install
Arbeit zu haben, wie erwartet?
Ich habe versucht, so weit
- Base64Encode (
<username>:<password>
)- Ergebnisse in
npm info retry will retry, error on last attempt: Error: socket hang up
- Ergebnisse in
- Base64Encode (urlencode (
<username>:<password>
))- Ergebnisse in
npm info retry will retry, error on last attempt: Error: This request requires auth credentials. Run `npm login` and repeat the request.
- Ergebnisse in
- Base64Encode (urlencode (
<username>
):
urlencode (<password>
))- Ergebnisse in
npm info retry will retry, error on last attempt: Error: socket hang up
- Ergebnisse in
Wenn die socket hang up
Fehler bekomme ich die folgende Stack-Trace haben:
http request GET https://<host>/nexus/content/repositories/npmjs-registry/fsevents
sill fetchPackageMetaData Error: socket hang up
sill fetchPackageMetaData at TLSSocket.onHangUp (_tls_wrap.js:1035:19)
sill fetchPackageMetaData at TLSSocket.g (events.js:260:16)
sill fetchPackageMetaData at emitNone (events.js:72:20)
sill fetchPackageMetaData at TLSSocket.emit (events.js:166:7)
sill fetchPackageMetaData at endReadableNT (_stream_readable.js:905:12)
sill fetchPackageMetaData at doNTCallback2 (node.js:441:9)
sill fetchPackageMetaData at process._tickCallback (node.js:355:17)
sill fetchPackageMetaData error for [email protected]^1.0.0 { [Error: socket hang up] code: 'ECONNRESET' }
WARN install Couldn't install optional dependency: socket hang up
verb install Error: socket hang up
verb install at TLSSocket.onHangUp (_tls_wrap.js:1035:19)
verb install at TLSSocket.g (events.js:260:16)
verb install at emitNone (events.js:72:20)
verb install at TLSSocket.emit (events.js:166:7)
verb install at endReadableNT (_stream_readable.js:905:12)
verb install at doNTCallback2 (node.js:441:9)
verb install at process._tickCallback (node.js:355:17)
Wenn immer die This request requires auth credentials
Fehler ich folgende Stack-Trace haben:
npm sill fetchPackageMetaData Error: This request requires auth credentials. Run `npm login` and repeat the request.
npm sill fetchPackageMetaData at CachingRegistryClient.authify (<root>\ui\target\node\node_modules\npm\node_modules\npm-registry-client\lib\authify.js:17:14)
npm sill fetchPackageMetaData at CachingRegistryClient.makeRequest (<root>\ui\target\node\node_modules\npm\node_modules\npm-registry-client\lib\request.js:103:17)
npm sill fetchPackageMetaData at <root>\ui\target\node\node_modules\npm\node_modules\npm-registry-client\lib\request.js:66:17
npm sill fetchPackageMetaData at RetryOperation._fn (<root>\ui\target\node\node_modules\npm\node_modules\npm-registry-client\lib\attempt.js:18:5)
npm sill fetchPackageMetaData at null._onTimeout (<root>\ui\target\node\node_modules\npm\node_modules\retry\lib\retry_operation.js:49:10)
npm sill fetchPackageMetaData at Timer.listOnTimeout (timers.js:92:15)
npm sill fetchPackageMetaData error for [email protected]^1.0.0 [Error: This request requires auth credentials. Run `npm login` and repeat the request.]
npm WARN install Couldn't install optional dependency: This request requires auth credentials. Run `npm login` and repeat the request.
npm verb install Error: This request requires auth credentials. Run `npm login` and repeat the request.
npm verb install at CachingRegistryClient.authify (<root>\ui\target\node\node_modules\npm\node_modules\npm-registry-client\lib\authify.js:17:14)
npm verb install at CachingRegistryClient.makeRequest (<root>\ui\target\node\node_modules\npm\node_modules\npm-registry-client\lib\request.js:103:17)
npm verb install at <root>\ui\target\node\node_modules\npm\node_modules\npm-registry-client\lib\request.js:66:17
npm verb install at RetryOperation._fn (<root>\ui\target\node\node_modules\npm\node_modules\npm-registry-client\lib\attempt.js:18:5)
npm verb install at null._onTimeout (<root>\ui\target\node\node_modules\npm\node_modules\retry\lib\retry_operation.js:49:10)
npm verb install at Timer.listOnTimeout (timers.js:92:15)
Vielen Dank im Voraus.