Skip to content

vp up -g skips all global packages with EBADDEVENGINES when run inside a project with devEngines.packageManager: pnpm #2437

Description

@carlwangx

Describe the bug

vp up -g checks each global package for updates by shelling out to npm view <spec> version --json. The spawned npm inherits the caller's working directory, so when the command is run from inside a project whose package.json declares devEngines.packageManager with pnpm (the default scaffolded by vp create, with onFail: "download"), npm refuses to run any command there and exits with EBADDEVENGINES.

As a result every global package version check fails, each one is skipped with a warning, and vp up -g falsely reports:

All global packages are up to date

…while updates are actually available. Running the exact same command from a directory without a devEngines declaration (e.g. $HOME) finds and applies the updates.

This is the same failure class as #1893 (vp infonpm viewEBADDEVENGINES), but in a different code path that wasn't covered by that fix: the global registry helper spawns npm view without setting current_dir:

async fn npm_view(
npm_path: &AbsolutePathBuf,
node_bin_dir: &AbsolutePathBuf,
package_spec: &str,
field: &str,
) -> Result<Vec<u8>, Error> {
let output = Command::new(npm_path.as_path())
.args(["view", package_spec, field, "--json"])
.env("PATH", format_path_prepended(node_bin_dir.as_path()))
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.output()
.await?;
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr).trim().to_string();
return Err(Error::Other(format!("npm view failed for {package_spec}: {stderr}").into()));
}
Ok(output.stdout)
}

Expected: the global update check should be independent of the project the shell happens to be in — e.g. run npm view with a neutral working directory (such as VP_HOME), since global package metadata has nothing to do with the local project.

I don't intend to submit a PR for this.

Reproduction

No repository needed — reproducible with a two-line package.json, see steps below.

Steps to reproduce

mkdir /tmp/repro && cd /tmp/repro
cat > package.json <<'EOF'
{
  "name": "repro",
  "devEngines": {
    "packageManager": { "name": "pnpm", "version": "11.17.0", "onFail": "download" }
  }
}
EOF
vp add -g wrangler   # any global package, installed at a non-latest version or not
vp up -g

Every global package prints warn: npm view failed for <pkg>: npm error code EBADDEVENGINES; skipping, then vp up -g reports "All global packages are up to date". Run cd ~ && vp up -g and the same packages are checked and updated normally.

System Info

$> vp env current
Environment:
  Version  24.19.0
  Source   lts

Tool Paths:
  node  /Users/carl/.vite-plus/js_runtime/node/24.19.0/bin/node
  npm   /Users/carl/.vite-plus/js_runtime/node/24.19.0/bin/npm
  npx   /Users/carl/.vite-plus/js_runtime/node/24.19.0/bin/npx

$> vp --version
vp v0.2.9

Local vite-plus:
  vite-plus  Not found

Environment:
  Package manager  Not found
  Node.js          v24.19.0

OS: macOS 26 (arm64)

Used Package Manager

pnpm

Logs

$> vp up -g   # run inside a project with devEngines.packageManager = pnpm
warn: npm view failed for @larksuite/cli: npm error code EBADDEVENGINES; skipping
warn: npm view failed for cf: npm error code EBADDEVENGINES; skipping
warn: npm view failed for pm2: npm error code EBADDEVENGINES; skipping
warn: npm view failed for skills: npm error code EBADDEVENGINES; skipping
warn: npm view failed for wrangler: npm error code EBADDEVENGINES; skipping
All global packages are up to date

# what npm itself says when invoked from that directory:
$> npm view wrangler version
npm error EBADDEVENGINES The developer of this package has specified the following through devEngines
npm error EBADDEVENGINES Invalid devEngines.packageManager
npm error EBADDEVENGINES Invalid name "pnpm" does not match "npm" for "packageManager"
npm error EBADDEVENGINES {
npm error EBADDEVENGINES   current: { name: 'npm', version: '11.17.0' },
npm error EBADDEVENGINES   required: { name: 'pnpm', version: '11.17.0', onFail: 'download' }
npm error EBADDEVENGINES }

# same command from $HOME immediately afterwards:
$> cd ~ && vp up -g
info: Updating 2 global packages with Node.js 24.19.0
✓ Updated @larksuite/cli to 1.0.86
✓ Updated wrangler to 4.122.0

Validations

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

Priority

None yet

Effort

None yet

Target date

None yet

Start date

None yet

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions