Skip to content

Pinning bundled npm does not work #953

@Sh4rK

Description

@Sh4rK

Hi,

If I pin a node version in a project (let's say 15.11.0), this is added to package.json:

  "volta": {
    "node": "15.11.0"
  }

So far so good.

However, if I want to make sure that the bundled npm is used, and run volta pin npm@bundled, nothing happens, package.json is not updated with anything.

This is problematic, because there's no distinction between two cases:

  • I want to use the bundled npm.
  • I want to use the global default npm.

And in fact, if I set a different npm version as global default, that's gonna be the one that's executed in the project directory, not the bundled one.

To remedy this, I think there could be two solutions:

  • If node is pinned in the project, but npm is not, use bundled npm.
    This would intuitively make sense to me, since there supposedly wouldn't be much value in fixing node, but allowing whatever npm, since the point is to standardize the environment (and also, for example, the package-lock.json format can depend on npm version, so you want to keep it aligned between developers).
  • Introduce bundled as a valid version for npm in package.json, like on the command line.
    This is more explicit than the above, but for reasons explained there, I prefer that option to this one.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions