GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — npm shim is not used when running the npm command from a script · Issue #1935 · voidzero-dev/vite-plus

npm shim is not used when running the npm command from a script #1935

New issue
Copy link
New issue
Copy link
Closed
Bug
#1938
Closed
npm shim is not used when running the npm command from a script#1935
Bug
#1938
Copy link
Assignees
liangmiQwQ
Labels
bugSomething isn't working
Milestone
Beta

Description

@Adrian-Baran-GY
Adrian-Baran-GY
opened on Jun 24, 2026
Issue body actions

Describe the bug

When running npm command from a script by using childProcess.execSync ~/.vite-plus/js_runtime/node/22.22.0/bin/npm is used instead of ~/.vite-plus/bin/npm, becuse ~/.vite-plus/js_runtime/node/22.22.0/bin is added before /home/ch4cha/.vite-plus/bin in the PATH. Is this expected behaviour? This is confusing as the output from npm --version command and childProcess.execSync("which npm", { cwd: projectDir, encoding: "utf-8", stdio: "pipe" }) differs.

Reproduction

Steps to reproduce

Given following package.json:

{
  "name": "test",
  "version": "1.0.0",
  "type": "module",
  "devEngines": {
    "packageManager": {
      "name": "npm",
      "version": "11.17.0",
      "onFail": "download"
    },
    "runtime": {
      "name": "node",
      "version": "22.22.0",
      "onFail": "download"
    }
  }
}

we have:

npm --version
# 11.17.0
which npm
# ~/.vite-plus/bin/npm

which is expected.

Given index.js:

import childProcess from "node:child_process";
import path from "node:path";

const projectDir = path.resolve(import.meta.dirname, ".");

try {
  const output = childProcess.execSync(`which npm`, {
    cwd: projectDir,
    encoding: "utf-8",
    stdio: "pipe",
  });
  console.log(output);
} catch (error) {
  console.error(String(error));
}

try {
  const output = childProcess.execSync(`npm --version`, {
    cwd: projectDir,
    encoding: "utf-8",
    stdio: "pipe",
  });
  console.log(output);
} catch (error) {
  console.error(String(error));
}

node index.js output is:

~/.vite-plus/js_runtime/node/22.22.0/bin/npm

11.14.1

npm version reported from the script is 11.14.1 instead of 11.17.0. This is because ~/.vite-plus/js_runtime/node/22.22.0/bin/npm is used instead of ~/.vite-plus/bin/npm. Is this expected? I would assume running commands via the script would use the same env as regular commands in the same directory.

System Info

VITE+ - The Unified Toolchain for the Web

Environment:
  Version       22.22.0
  Source        devEngines.runtime
  Source Path   ~/ps/test/package.json
  Project Root  ~/ps/test

Tool Paths:
  node  ~/.vite-plus/js_runtime/node/22.22.0/bin/node
  npm   ~/.vite-plus/js_runtime/node/22.22.0/bin/npm
  npx   ~/.vite-plus/js_runtime/node/22.22.0/bin/npx

Package Manager:
  Name          npm
  Version       11.17.0
  Source        devEngines.packageManager
  Source Path   ~/ps/test/package.json
  Project Root  ~/ps/test
  Bin Path      ~/.vite-plus/package_manager/npm/11.17.0/npm/bin/npm



VITE+ - The Unified Toolchain for the Web

vp v0.2.1

Local vite-plus:
  vite-plus  Not found

Tools:
  vite             Not found
  rolldown         Not found
  vitest           Not found
  oxfmt            Not found
  oxlint           Not found
  oxlint-tsgolint  Not found
  tsdown           Not found

Environment:
  Package manager  npm v11.17.0
  Node.js          v22.22.0 (devEngines.runtime)

Used Package Manager

npm

Validations

  • Read the Contributing Guidelines.
  • Check that there isn't already an issue for the same bug.
  • Confirm this is a Vite+ issue and not an upstream issue (Vite, Vitest, tsdown, Rolldown, or Oxc).
  • The provided reproduction is a minimal reproducible example.
Reacted by Liang

Activity

  1. Adrian-Baran-GY
    added the
    Bug
    issue type on Jun 24, 2026
  2. Adrian-Baran-GY
    added
    pending triage
    on Jun 24, 2026
  3. liangmiQwQ
    added
    bugSomething isn't working
    and removed
    pending triage
    on Jun 24, 2026
  4. liangmiQwQ
    self-assigned this
    on Jun 24, 2026
  5. fengmk2
    added this to the Beta milestone on Jun 24, 2026
  6. fengmk2
    added a commit that references this issue on Jun 25, 2026

    fix(env): preserve managed npm in node child processes (#1938)

    This issue will close once commit f7d2849 is merged into the 'main' branch.
    f7d2849
  7. fengmk2
    closed this as completedin #1938on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @liangmiQwQ
    liangmiQwQ

Labels

bugSomething isn't working

Type

Bug

Fields

Priority

None yet

Effort

None yet

Target date

None yet

Start date

None yet

Projects

No projects

    Milestone

    • Beta

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.