Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage Error: This project is configured to use yarn #424

Open
cdtut opened this issue Mar 11, 2024 · 5 comments
Open

Usage Error: This project is configured to use yarn #424

cdtut opened this issue Mar 11, 2024 · 5 comments

Comments

@cdtut
Copy link

cdtut commented Mar 11, 2024

If you have pnpm and yarn projects try change to yarn_project and run pnpm --dir pnpm_project or change to pnpm_project and run yarn --cwd yarn_project. There is error Usage Error: This project is configured to use yarn. Should be no error to use like this.

@arcanis
Copy link
Contributor

arcanis commented Mar 11, 2024

That's the expected behaviour. See the documentation:

COREPACK_ENABLE_STRICT can be set to 0 to prevent Corepack from throwing error if the package manager does not correspond to the one defined for the current project. This means that if a user is using the package manager specified in the current project, it will use the version specified by the project's packageManager field. But if the user is using other package manager different from the one specified for the current project, it will use the system-wide package manager version.

You can also explicitly call corepack yarn ... on pnpm projects (or corepack pnpm ... on Yarn projects) to bypass this check.

@cdtut
Copy link
Author

cdtut commented Mar 11, 2024

Even with no COREPACK_ENABLE_STRICT the error should not happen if pnpm --dir or yarn --cwd point to location outside current project.

@arcanis
Copy link
Contributor

arcanis commented Mar 11, 2024

Corepack has no knowledge of what the underlying package manager CLIs look like, and can only make trivial assumptions about it. If you want a similar behaviour, you'll need to cd into the target directory and run the command from there.

@cdtut
Copy link
Author

cdtut commented Mar 11, 2024

can only make trivial assumptions about it

Can be trivial if --dir is on pnpm or --cwd is on yarn then skip warning.

@drazisil
Copy link

In my case, the error occurred because I had pnpm in the script that I was trying to run with yarn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants