-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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] npm config removes _auth from .npmrc #2300
Comments
Does it still happen with v7.0.15? |
Not sure, I haven't found a way to update npm in the node docker image. |
|
The node docker image fails to update npm that way. Some permissions issue. I have confirmed that it still happens for npm@7.0.15 on MacOS. |
This is happening because In order for credentials to be saved, a username, email address, and password must all be set, and it is re-saved to the config file scoped only to the proper registry. This works as expected, for example:
|
Note that |
@isaacs This appears to be a change in behavior relative to versions prior to npm v7. Is the methodology you describe backward compatible? If so, how far back? |
@isaacs The methodology you describe does not seem to work for |
In versions prior to npm v7 we used to be able to use the following to configure authentication:
With npm v7+ it does not appear to be possible to use
or
|
Aha, seems like the issue here is that npm config set registry http://npm.example.com/
npm config set always-auth true
echo "email=my@example.com" >> ~/.npmrc
npm config set _auth YWRtaW46YWRtaW4= |
Will be fixed on next npm release, with @npmcli/config@1.2.8 |
While digging into #2300, I realized it would be a lot easier if we could do this: npm config set email=me@example.com _auth=xxxx and avoid the whole issue of what gets set first. Also, why not let `npm config get foo bar baz` return just the keys specified? Also updates the docs, including the statement that `npm config set foo` with no value sets it to `true`, when as far as I can tell, that has never been the case.
While digging into #2300, I realized it would be a lot easier if we could do this: npm config set email=me@example.com _auth=xxxx and avoid the whole issue of what gets set first. Also, why not let `npm config get foo bar baz` return just the keys specified? Also updates the docs, including the statement that `npm config set foo` with no value sets it to `true`, when as far as I can tell, that has never been the case.
While digging into #2300, I realized it would be a lot easier if we could do this: npm config set email=me@example.com _auth=xxxx and avoid the whole issue of what gets set first. Also, why not let `npm config get foo bar baz` return just the keys specified? Also updates the docs, including the statement that `npm config set foo` with no value sets it to `true`, when as far as I can tell, that has never been the case.
So, just to clarify:
|
While digging into #2300, I realized it would be a lot easier if we could do this: npm config set email=me@example.com _auth=xxxx and avoid the whole issue of what gets set first. Also, why not let `npm config get foo bar baz` return just the keys specified? Also updates the docs, including the statement that `npm config set foo` with no value sets it to `true`, when as far as I can tell, that has never been the case. PR-URL: #2362 Credit: @isaacs Close: #2362 Reviewed-by: @nlf
* Support setting email without username/password Fixes: #2300
still happening in npm8 |
Current Behavior:
npm config set <anykey> <anyvalue>
will result in_auth=...
being removed from.npmrc
Expected Behavior:
npm config set foo bar
should not result in_auth=...
being removed from.npmrc
Steps To Reproduce:
echo '_auth="xxx"' >> ~/.npmrc
cat ~/.npmrc
to see_auth="xxx"
is therenpm config set foo bar
cat ~/.npmrc
to see_auth="xxx"
is goneEnvironment:
Docker image
node:15.3.0
Node: 15.3.0
npm: 7.0.14
The text was updated successfully, but these errors were encountered: