Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot set _auth without first setting email #2852

Open
jorenbroekema opened this issue Mar 11, 2021 · 4 comments
Open

[BUG] Cannot set _auth without first setting email #2852

jorenbroekema opened this issue Mar 11, 2021 · 4 comments
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 7.x work is associated with a specific npm 7 release

Comments

@jorenbroekema
Copy link

Current Behavior:

npm config set _auth foo
# Error: Cannot set _auth without first setting email 

npm config set email foo@example.com

npm config get email # undefined ?????

So I try adding email to my npmrc directly, then:

npm config get email # foo@example.com

npm config set proxy http://localhost:3128
npm config get email # undefined ??!?!?!?

Seems like doing npm config set gets rid of your email, no matter which key you are setting (including email itself)

Expected Behavior:

  • npm config set to not delete email setting
  • npm config set _auth to work regardless of whether email is set.

Steps To Reproduce:

  1. Upgrade to latest npm 7
  2. Run npm set config _auth foo
  3. See error...

Environment:

  • OS: MacOS Catalina 10.15.7
  • Node: 14.13.0
  • npm: 7.6.2

Log:

20 info config set "_auth" "foo"
21 timing command:config Completed in 1ms
22 verbose stack Error: Cannot set _auth without first setting email
22 verbose stack     at Config.set (/usr/local/Cellar/node/14.13.0/lib/node_modules/npm/node_modules/@npmcli/config/lib/index.js:184:15)
22 verbose stack     at Config.set (/usr/local/Cellar/node/14.13.0/lib/node_modules/npm/lib/config.js:123:23)
22 verbose stack     at Config.config (/usr/local/Cellar/node/14.13.0/lib/node_modules/npm/lib/config.js:91:22)
22 verbose stack     at Config.exec (/usr/local/Cellar/node/14.13.0/lib/node_modules/npm/lib/config.js:83:10)
22 verbose stack     at Object.[_runCmd] (/usr/local/Cellar/node/14.13.0/lib/node_modules/npm/lib/npm.js:112:12)
22 verbose stack     at /usr/local/Cellar/node/14.13.0/lib/node_modules/npm/lib/npm.js:28:35
22 verbose stack     at Object.<anonymous> (/usr/local/Cellar/node/14.13.0/lib/node_modules/npm/lib/cli.js:58:7)
@jorenbroekema jorenbroekema added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Mar 11, 2021
@wraithgar wraithgar added Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels Mar 26, 2021
@bbodenmiller
Copy link

bbodenmiller commented May 22, 2021

It looks like this is fixed now as email is no longer required as of 7.11.2: https://github.com/npm/cli/blob/latest/CHANGELOG.md#v7112-2021-04-29, https://github.com/npm/config/pull/16/files

@jorenbroekema
Copy link
Author

Checked with latest npm 7.17.0

This bug persists, and I just saw it happen to the _auth property too.
~/.npmrc:

always-auth=true
_auth=mypassword

then

npm config set foo bar

~/.npmrc:

always-auth=true
foo=bar

@hanaavram
Copy link

Is there any workaround for this? it's a blocker

@prabhatmishra-metro
Copy link

prabhatmishra-metro commented Dec 8, 2021

Please prioritized this or suggest any alternative we can have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

5 participants