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] Windows-style environment variables in npm scripts are no longer expanded #2731

Closed
ehoogeveen-medweb opened this issue Feb 19, 2021 · 2 comments · Fixed by npm/run-script#22
Assignees
Labels
Bug thing that needs fixing platform:windows is Windows-specific Priority 1 high priority issue Release 7.x work is associated with a specific npm 7 release

Comments

@ehoogeveen-medweb
Copy link

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
@ehoogeveen-medweb ehoogeveen-medweb added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Feb 19, 2021
@darcyclarke darcyclarke added platform:windows is Windows-specific and removed Needs Triage needs review for next steps labels Feb 19, 2021
@darcyclarke darcyclarke added the Priority 1 high priority issue label Feb 19, 2021
@darcyclarke
Copy link
Contributor

In-Review PR to resolve this: npm/run-script#22

@ehoogeveen-medweb
Copy link
Author

I can confirm that windows-style environment variables work again with npm v7.7.0 (which includes @npmcli/run-script v1.8.4), thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing platform:windows is Windows-specific Priority 1 high priority issue Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants