fix: v2.5.1 — plugin npm runs no longer depend on PATH (Windows update failure)
A Windows self-update failed at "bootstrap": 'npm.cmd' is not recognized. The update chain runs with the dashboard server's environment, whose PATH need not reach npm.cmd, and the bootstrap looked npm up through cmd.exe (shell: true, which also printed DEP0190). - npmCommand() in scripts/plugin-bootstrap.js runs the npm bundled with the running node (npm-cli.js beside process.execPath, Windows and Unix layouts) with no shell, and puts that node's directory first on PATH (kept under the env's own Path/PATH key) so npm scripts find the same node; npm on PATH only when that node ships none - Used by the runtime install, the UI build (plugin-open.js) and the doctor's npm row (plugin-doctor.js)
This commit is contained in:
@@ -125,10 +125,9 @@ function runtimeDepsStatus(rt) {
|
||||
|
||||
/** No npm, no dashboard bundle and no runtime install — both go through it. */
|
||||
function npmStatus() {
|
||||
const res = spawnSync(process.platform === "win32" ? "npm.cmd" : "npm", ["-v"], {
|
||||
encoding: "utf8",
|
||||
shell: process.platform === "win32",
|
||||
});
|
||||
// The same npm the bootstrap and the UI build run (`npmCommand`), not PATH's.
|
||||
const npm = boot.npmCommand(["-v"]);
|
||||
const res = spawnSync(npm.file, npm.args, { encoding: "utf8", env: npm.env, shell: npm.shell });
|
||||
if (res.status !== 0) {
|
||||
return ["fail", "npm", "not runnable — the runtime install and the UI build both need it"];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user