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] PATH is polluted when running npm run <script> #8111

Open
2 tasks done
ReenigneArcher opened this issue Feb 15, 2025 · 0 comments
Open
2 tasks done

[BUG] PATH is polluted when running npm run <script> #8111

ReenigneArcher opened this issue Feb 15, 2025 · 0 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps

Comments

@ReenigneArcher
Copy link

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

This is the same as npm/npm#12318, which was fixed, and then unfixed in npm v7.

#2808

I am trying to run an npm script from an activated python venv; but I cannot use my python venv in the script because npm overrides the path, thus making the system python interpreter the one that is picked up by the script instead of the venv python.

Expected Behavior

Do not change path order

Steps To Reproduce

  1. Create and activate python venv: https://docs.python.org/3/library/venv.html
  2. With this config...
{
    "name": "python-venv-bug",
    "version": "0.1.0",
    "description": "Python venv bug",
    "scripts": {
        "python-venv": "python3 -c \"import sys; print(sys.executable)\"",
    },
}
  1. Run npm run python-venv
  2. See the output is not the python venv that was already active

Environment

  • npm: 11.1.0
  • Node.js: v22.12.0
  • OS Name: Windows 11
  • System Model Name:
  • npm config:
; "builtin" config from C:\Users\ReenigneArcher\AppData\Roaming\npm\node_modules\npm\npmrc

prefix = "C:\\Users\\ReenigneArcher\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v22.12.0
; npm local prefix = C:\Users\ReenigneArcher\Dev\git\devicon
; npm version = 11.1.0
; cwd = C:\Users\ReenigneArcher\Dev\git\devicon
; HOME = C:\Users\ReenigneArcher
; Run `npm config ls -l` to show all defaults.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps
Projects
None yet
Development

No branches or pull requests

1 participant