-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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 exec
unnecessarily sets $PREFIX
#2398
Comments
Patch welcome, yes this is unnecessary, I agree. |
Can you point me to the relevant package/file to start looking? |
Sure, sorry for the vague response, had meant to come back to this and forgot to. It's getting set here, looks like: https://github.com/npm/config/blob/main/lib/set-envs.js#L60 |
Hmm - looking at that, It seems important to set it when it was set in the first place, and not to set it when it wasn't, but it's not clear to me how to do that. Any tips? |
I could see two possible approaches here.
With either approach, we should float the patch on the npm cli and make sure it doesn't break any tests there. Any tests that are broken in npm/config are probably just asserting that I can't really justify why we set env.PREFIX. It was just carried forward by default from npm v6, and since we now use |
Indeed; termux uses it which causes unavoidable issues for nvm :-/ It seems less breaking to me to go with option 2. I'll make a PR soon that does that, and then we can try it on the CLI. |
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
There is really no need to set PREFIX, even if already set. I think maybe we should just remove it? It looks like it was only added because Scons needed it to build node binary modules, back in the dark ages before node-gyp. |
Awesome; i hadn’t had a chance to get to it yet. |
* Restore npm v6 behavior with INIT_CWD This should always be set to the npm cwd, even if already in the env. Fix: npm/cli#2578 * Do not set the PREFIX environment variable Fix: npm/cli#2398
Current Behavior:
Expected Behavior:
Setting
$PREFIX
breaksnvm
, and there seems to be zero point in setting it when it wasn't set in the spawning shell.Steps To Reproduce:
See "current behavior" above.
Environment:
See nvm-sh/nvm#2379 for context.
The text was updated successfully, but these errors were encountered: