`pnpm install` Usage Error: This project is configured to use yarn

`pnpm install` Usage Error: This project is configured to use yarn

我正在尝试从 yarn 迁移到 pnpm。我运行pnpm install。它立即失败并打印到控制台:

Usage Error: This project is configured to use yarn

$ pnpm ...

我尝试删除(实际上重命名)yarn.locknode_modules 但无济于事。如何解决?

我发现这是因为:

{
 // ...
 "packageManager": "yarn@..."
 // ...
}

删除(或将其更改为 pnpm)将解决问题。此外,yarn.lock 存在与问题无关。