You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
npm shim does not consult packageManager field #1629
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 npm@11.14.1: npm i -g npm@11.14.1.
Set packageManager field to npm@11.14.0: npm pkg set npm@11.14.0
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 npm@11.14.0, 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`
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.
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?
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.
@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?
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.
Activity
fengmk2 commentedon May 20, 2026
Currently, we will not change npm's version selection logic. Only when running package manager-related commands with
vpwill thepackageManagerconfig be followed.bouzlibop commentedon May 20, 2026
Could you explain a bit more? What's confusing to me is that
node --versionproperly reports the version resolved for a given project. Why thennpm --versionworks differently instead of also giving project specific results?bouzlibop commentedon May 20, 2026
Also, the output of
vp env currentdoes not reportnpmversion:In order to check what is the resolved
npmversion whichvpwill use in a given project I didvp 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
vpsees and why.fengmk2 commentedon 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 commentedon May 21, 2026
Yes I think we should if
packageManagerexplicitly declaresnpm@<version>. If the project is configured with pnpm /yarn/bun, it should not turn annpm installinto apnpm install.fengmk2 commentedon 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.