Skip to content

Prevent npm calls for projects that use other package managers #1972

Description

@liangmiQwQ

Description

Currently, Vite+ allows npm runs in a project using other package managers, even if we mark like "packageManager": "pnpm@10.33.2".

We can take a look at corepack's behavior, which will print an error and stop users from running other an incompatible package manager.

% pnpm i                                
This project is configured to use npm because /Users/liangmi/code/npm/cli/package.json has a "packageManager" field

Suggested solution

We've already merged #1629, similar to it, we could also add a check logic, if the Vite+ detects this project is using other pms, we can print a similar error and prevent users running it.

Additional context

In addition, for npm version management, Vite+ takes over corepack's duty, so I believe it is very meaningful to add it.

Metadata

Metadata

Assignees

No one assigned

    Priority

    None yet

    Start date

    None yet

    Target date

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions