-
Notifications
You must be signed in to change notification settings - Fork 215
fix(env): preserve managed npm in node child processes #1938
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
Merged
fengmk2
merged 10 commits into
voidzero-dev:main
from
liangmiQwQ:liang/codex/fix-node-managed-pm-path
Jun 25, 2026
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
38516f5
fix(env): preserve managed npm in node child processes
liangmiQwQ 5881481
fix(env): apply managed npm path to js shim execution
liangmiQwQ 4df0c87
Merge branch 'main' into liang/codex/fix-node-managed-pm-path
liangmiQwQ 4317eb1
fix fmt
liangmiQwQ 146d61f
test(cli): split managed npm snap steps
liangmiQwQ 75846dd
enhance
liangmiQwQ 3a8d750
wip
liangmiQwQ 6acf3ea
Merge branch 'main' into liang/codex/fix-node-managed-pm-path
fengmk2 81fda91
enhance
liangmiQwQ 3876c03
adjust
liangmiQwQ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/cli/snap-tests-global/env-node-child-process-npm/node/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "name": "@env-node-child-process-npm/node", | ||
| "version": "1.0.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "devEngines": { | ||
| "runtime": { | ||
| "name": "node", | ||
| "version": "20.18.0", | ||
| "onFail": "download" | ||
| } | ||
| } | ||
| } |
3 changes: 3 additions & 0 deletions
3
packages/cli/snap-tests-global/env-node-child-process-npm/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "type": "module" | ||
| } |
6 changes: 6 additions & 0 deletions
6
packages/cli/snap-tests-global/env-node-child-process-npm/print-path.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { execFileSync } from 'node:child_process'; | ||
|
|
||
| const npmPath = execFileSync('which', ['npm'], { encoding: 'utf8' }).trim(); | ||
| const normalizedNpmPath = npmPath.split('/').join('/'); | ||
|
|
||
| console.log(normalizedNpmPath); |
6 changes: 6 additions & 0 deletions
6
packages/cli/snap-tests-global/env-node-child-process-npm/print-version.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { execFileSync } from 'node:child_process'; | ||
|
|
||
| const versionOutput = execFileSync('npm', ['--version'], { encoding: 'utf8' }).trim(); | ||
| const version = versionOutput.split(/\r?\n/).at(-1); | ||
|
|
||
| console.log(version); |
5 changes: 5 additions & 0 deletions
5
packages/cli/snap-tests-global/env-node-child-process-npm/snap.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| > cd node && test "$(npm --version)" = "$(node ../print-version.js)" && node ../print-path.js | ||
| <vite-plus-home>/js_runtime/node/<semver>/bin/npm | ||
|
|
||
| > cd specific && test "$(npm --version)" = "$(node ../print-version.js)" && test "$(node ../print-version.js)" = "$(node ./print-package-json-pm-version.js)" && node ../print-path.js | ||
| <vite-plus-home>/package_manager/npm/<semver>/npm/bin/npm |
18 changes: 18 additions & 0 deletions
18
packages/cli/snap-tests-global/env-node-child-process-npm/specific/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "name": "@env-node-child-process-npm/specific", | ||
| "version": "1.0.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "devEngines": { | ||
| "packageManager": { | ||
| "name": "npm", | ||
| "version": "11.17.0", | ||
| "onFail": "download" | ||
| }, | ||
| "runtime": { | ||
| "name": "node", | ||
| "version": "20.18.0", | ||
| "onFail": "download" | ||
| } | ||
| } | ||
| } | ||
3 changes: 3 additions & 0 deletions
3
...li/snap-tests-global/env-node-child-process-npm/specific/print-package-json-pm-version.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import packageJson from './package.json' assert { type: 'json' }; | ||
|
|
||
| console.log(packageJson.devEngines.packageManager.version); |
7 changes: 7 additions & 0 deletions
7
packages/cli/snap-tests-global/env-node-child-process-npm/steps.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "ignoredPlatforms": ["win32"], | ||
| "commands": [ | ||
| "cd node && test \"$(npm --version)\" = \"$(node ../print-version.js)\" && node ../print-path.js", | ||
| "cd specific && test \"$(npm --version)\" = \"$(node ../print-version.js)\" && test \"$(node ../print-version.js)\" = \"$(node ./print-package-json-pm-version.js)\" && node ../print-path.js" | ||
| ] | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.