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] NPM_CONFIG_PREFIX is ignored during install #4467

Closed
2 tasks done
chr15m opened this issue Feb 24, 2022 · 6 comments
Closed
2 tasks done

[BUG] NPM_CONFIG_PREFIX is ignored during install #4467

chr15m opened this issue Feb 24, 2022 · 6 comments
Assignees
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 8.x work is associated with a specific npm 8 release

Comments

@chr15m
Copy link

chr15m commented Feb 24, 2022

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

Current Behavior

Trying to set the prefix config option using environment variables as documented here:

https://docs.npmjs.com/cli/v8/using-npm/config#environment-variables

The current behaviour is that the output from these two commands is different.

NPM_CONFIG_PREFIX=dingle npm config ls -l | grep prefix
npm --prefix dingle config ls -l | grep prefix

In addition, currently this command:

NPM_CONFIG_PREFIX=dingle npm install doodle.css

does not install into the folder dingle whereas this command does:

npm install --prefix dingle doodle.css

Expected Behavior

Expected behaviour setting the prefix via either NPM_CONFIG_PREFIX or --prefix has the same results and installs into the specified folder.

Steps To Reproduce

  1. $ npm --version -> 8.1.2
  2. Run NPM_CONFIG_PREFIX=dingle npm config ls -l | grep prefix and npm --prefix dingle config ls -l | grep prefix
  3. Observe the output is different

Environment

  • npm: 8.1.2
  • Node.js: v16.13.1
  • OS Name: Ubuntu Linux
  • System Model Name: Dell XPS 13
  • npm config:
; "user" config from /home/chrism/.npmrc

//registry.npmjs.org/:_authToken = (protected) 
unsafe-perm = true 

; node bin location = /home/chrism/.nvm/versions/node/v16.13.1/bin/node
; cwd = /home/chrism/dev/npm-prefix-test
; HOME = /home/chrism
; Run `npm config ls -l` to show all defaults.
@chr15m chr15m added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Feb 24, 2022
@ljharb
Copy link
Contributor

ljharb commented Feb 24, 2022

Do you mean NPM_CONFIG_PREFIX? NODE_CONFIG isn’t a thing.

@fritzy
Copy link
Contributor

fritzy commented Feb 24, 2022

It looks like npm_config_prefix isn't working as expected. This may be due to a recent change with implicit workspace detection (or may be unrelated).

@fritzy fritzy added Priority 1 high priority issue and removed Needs Triage needs review for next steps labels Feb 24, 2022
@fritzy
Copy link
Contributor

fritzy commented Feb 24, 2022

To clarify, I was able to reproduce the issue with the correct environment variable.

@fritzy fritzy changed the title [BUG] NODE_CONFIG_PREFIX is ignored during install [BUG] NPM_CONFIG_PREFIX is ignored during install Feb 24, 2022
@chr15m
Copy link
Author

chr15m commented Feb 24, 2022

Yes, thanks for picking that up. I used the wrong variable name in the bug description, but the bug is there with NPM_CONFIG_PREFIX.

@chr15m
Copy link
Author

chr15m commented Feb 25, 2022

I've updated the text of the ticket for clarity: NODE_CONFIG_PREFIX -> NPM_CONFIG_PREFIX.

@Santoshraj2
Copy link
Contributor

4467_latestVersion 4467_version_8 1 2

I see this is giving same result in both the latest as well as mentioned version(8.1.2), @chr15m let me know if you are still facing this.

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 1 high priority issue Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

5 participants