GeezerVison is showing github.com — `npm` shim does not consult `packageManager` field · Issue #1629 · voidzero-dev/vite-plus
npm shim does not consult packageManager field #1629
DescriptionDescribe the bug
npm shim (running $HOME/.vite-plus/bin/npm) does not consult packageManager field. This is confusing. While node --version will properly print the version, which respect .node-version. npm --version will use resolved Node.js npm version not the one specified in packageManager field.
Steps to reproduce
- Install
[email protected]: npm i -g [email protected].
- Set
packageManager field to [email protected]: npm pkg set [email protected]
- Run
vp install -- --verbose and then npm --version.
Expected:
Both commands should respect packageManager field. They both should print 11.14.0.
Actual:
vp install -- --verbose prints npm info using [email protected], which is expected, but npm --version print 11.14.1, which is confusing.
System Info
`vp v0.1.21`
`which npm` is `$HOME/.vite-plus/bin/npm`
Used Package Manager
npm
Validations
Reacted by Adrian-Baran-GY Activityfengmk2 commented on May 20, 2026 Currently, we will not change npm's version selection logic. Only when running package manager-related commands with vp will the packageManager config be followed. bouzlibop commented on May 20, 2026 Could you explain a bit more? What's confusing to me is that node --version properly reports the version resolved for a given project. Why then npm --version works differently instead of also giving project specific results? bouzlibop commented on May 20, 2026 Also, the output of vp env current does not report npm version:
Vite+ - The Unified Toolchain for the Web
Environment
Version 22.22.0
Source devEngines.runtime
Source Path $HOME/src/myapp/package.json
Project Root $HOME/src/myapp
Tool Paths:
node $HOME/.vite-plus/js_runtime/node/22.22.0/bin/node
npm $HOME/.vite-plus/js_runtime/node/22.22.0/bin/npm
npx $HOME/.vite-plus/js_runtime/node/22.22.0/bin/npx
In order to check what is the resolved npm version which vp will use in a given project I did vp install -- --version, which feels more like a hack than a proper approach. Is there a better way?
It would be helpful if we could print the resolved package manager, its version, source and source path similarly to Node info we have in the Environment part. Then it would be clear which package manger vp sees and why. fengmk2 commented on May 21, 2026 @cpojer What do you think? Should we make npm/pnpm/yarn handle it similarly to node's lookup logic? Prioritize using the configuration version of the current project, and fall back to the global version only if not found? cpojer commented on May 21, 2026 Yes I think we should if packageManager explicitly declares npm@<version>. If the project is configured with pnpm /yarn/bun, it should not turn an npm install into a pnpm install. fengmk2 commented on May 21, 2026 Okay, I will refer to the version lookup logic of node. npm/pnpm/yarn shims will run the correct version based on the packageManager field. Reacted by Adrian-Baran-GY
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|