Skip to content

npm shim does not consult packageManager field #1629

@bouzlibop

Description

@bouzlibop

Describe 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

  1. Install npm@11.14.1: npm i -g npm@11.14.1.
  2. Set packageManager field to npm@11.14.0: npm pkg set npm@11.14.0
  3. 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`

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Priority

    None yet

    Effort

    None yet

    Target date

    None yet

    Start date

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions