Skip to content

[BUG] Windows-style environment variables in npm scripts are no longer expanded #2731

@ehoogeveen-medweb

Description

@ehoogeveen-medweb

Current Behavior:

Our setup uses environment variables to pass parameters to npm scripts. With npm v7, Windows-style environment variables like %foo% are no longer expanded (on Windows).

Expected Behavior:

Windows-style environment variables used by npm scripts should be expanded (on Windows) like they are with npm v6. Alternatively, Unix-style environment variables should be made to work on Windows.

Steps To Reproduce:

  1. From a clean node project,
  2. Set the test script in package.json to "echo %HelloWorld%"
  3. In a command prompt, set the environment variable using set "HelloWorld=Hello world!"
  4. Run the script using npm run test
  5. With npm v7, the output is %HelloWorld% instead of Hello world!.

Environment:

  • OS: Windows 10 20H2
  • Node: 14.15.5
  • npm: 7.5.4

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 1high priority issueRelease 7.xwork is associated with a specific npm 7 releaseplatform:windowsis Windows-specific

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions