运行 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 无论如何都会提供包管理器二进制文件,并确保请求的版本始终可用,因此不需要显式安装包管理器。
¥Don't run this command; Corepack will provide the package manager binaries anyway and will ensure that the requested versions are always available, so installing the package managers explicitly isn't needed.
 - 
给
npm install加上--force标志;这将告诉 npm 可以覆盖二进制文件,但你将在此过程中删除 Corepack 文件。(运行corepack enable将它们添加回来。)¥Add the
--forceflag tonpm install; this will tell npm that it's fine to override binaries, but you'll erase the Corepack ones in the process. (Runcorepack enableto add them back.)