运行 npm install -g yarn 无效
【Running npm install -g yarn doesn't work】
npm 在进行全局安装时会防止意外覆盖 Corepack 二进制文件。为避免此问题,可以考虑以下几种方法:
【npm prevents accidentally overriding the Corepack binaries when doing a global install. To avoid this problem, consider one of the following options:】
- 不要运行这个命令;Corepack 无论如何都会提供包管理器的二进制文件,并确保所请求的版本始终可用,因此无需显式安装包管理器。
- 在
npm install中添加--force标志;这会告诉 npm 可以覆盖二进制文件,但在此过程中你会删除 Corepack 的二进制文件。(运行corepack enable可将它们添加回来。)