Skip to content

[BUG] NPM_CONFIG_PREFIX is ignored during install #4467

Closed
@chr15m

Description

@chr15m

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.

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 1high priority issueRelease 8.xwork is associated with a specific npm 8 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions