[BUG] E401 error message does not use the configured registry
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 75/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, nodejs
- Ambito
- cli, developer-experience
Direzione di ricerca
Il messaggio di errore viene generato in lib/utils/error-message.js alla riga 159. Inizia esaminando quel file per vedere come l'URL del registro è attualmente hardcoded. Controlla come npm recupera il registro configurato (probabilmente da npm.config). Modifica il messaggio di errore per utilizzare l'URL radice del registro configurato. Testa impostando un registro personalizzato in .npmrc e attivando un errore 401 con un comando npm come npm whoami o npm install senza autenticazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
This is not just a request to bump a dependency for a CVE
- This is not solely a request to bump a dependency for a CVE
Current Behavior
When npm has a 401 error, it constructs an error message that suggests recovering your password. But this error message has a hard-coded https://npmjs.org link, which is misleading when the authentication error occurred with a private npm registry, not the default npmjs.org registry.
Expected Behavior
The error message should display a link to the root of the custom registry if it is set, and fall back to the default https://npmjs.org/forgot. Note the custom registry likely won't be able to point to a /forgot subpage, but defaulting to the root of the custom registry would be more clear.
The reasoning for this request is that it is confusing for developers experiencing auth errors to see a link to the public npm registry when our team exclusively uses an internal mirror.
Steps To Reproduce
- Set up a .npmrc to point to an npm registry that requires authentication
- Make an npm install WITHOUT authenticating
- It should return a 401 with the error
npm error code E401 npm error Incorrect or missing password. npm error If you were trying to login, change your password, create an authentication token or enable two-factor authentication then that means you likely typed your password in incorrectly. npm error Please try again, or recover your password at: npm error https://www.npmjs.com/forgot npm error npm error If you were doing some other operation then your saved credentials are probably out of date. npm error To correct this please try logging in again with: npm error npm login npm error A complete log of this run can be found in: /home/kmurphy/.npm/_logs/2026-09-22T16_19_31_269Z-debug-0.log
The source code for the hard-coded error message is at:
Environment
- npm: 12.0.1
- Node.js: 26.10.0
- OS Name: Ubuntu 24.04
- System Model Name: all
- npm config:
; "user" config from /home/kmurphy/.npmrc
; //artifactory.mydomain.com/artifactory/api/npm/my-npm-mirror/:_authToken = (protected) ; overridden by project
; "project" config from /home/kmurphy/dev/MyProject/MySubdir/.npmrc
//artifactory.mydomain.com/artifactory/api/npm/my-npm-mirror/:_authToken = (protected)
registry = "https://artifactory.mydomain.com/artifactory/api/npm/my-npm-mirror/"
; node bin location = /home/kmurphy/.nvm/versions/node/v26.10.0/bin/node
; node version = v26.10.0
; npm local prefix = /home/kmurphy/dev/MyProject/MySubdir
; npm version = 12.0.2
; cwd = /home/kmurphy/dev/MyProject/MySubdir
; HOME = /home/kmurphy
; Run `npm config ls -l` to show all defaults.
- Lingua principale
- JavaScript
- Stelle
- 10.2k
- Fork
- 4.8k
- Merge medio
- 3g 21h
- PR unite (30g)
- 12
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di npm/cli
-
[BUG] v12.2.0 shipped a stale bundled lockfile after in-range security fixes were already publishedForse già presa @reggi l’ha presa 7 giorni fa. ApertaPriority 1
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
npm/cli#10062 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
create node pr: Node.js 20 deprecation & `DEP0040` warnings loggedForse già presa @lazerg l’ha presa 19 giorni fa. ApertaEngineering Priority 1
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
I maintainer di solito rispondono entro 1 giorno
-
Engineering Priority 2
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
`npm audit signatures` does not report how many packages it skipped for want of registry keysForse già presa @greenlincoln05 l’ha presa 16 giorni fa. ApertaPriority 3
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
[DOCS] Clarify whether `os`, `cpu`, and `libc` accept a string or must be an arrayForse già presa @SatvikMishra08 l’ha presa 16 giorni fa. ApertaDocumentation Priority 2
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Notifications pagination accepts NaN and negative LIMIT/OFFSETForse già presa @Senthil455 l’ha presa oggi. ApertaBUGS MEDIUM
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
elixpo/blogs.elixpo#419 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
immich-app/immich#32426 ·
I maintainer di solito rispondono entro 1 giorno
-
automated issue report
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
lirantal/discoprint#45 ·
I maintainer di solito rispondono entro 1 giorno