【问题标题】:How to run `corepack enable` to install Yarn berry?如何运行“corepack enable”来安装 Yarn berry?
【发布时间】:2022-08-20 07:34:48
【问题描述】:

对于 Yarn 的现代版本,又名 Yarn Berry,首选安装是通过 Corepack,Corepack 默认包含在 Node.js 安装中 (>=16.10)。见https://yarnpkg.com/getting-started/install

这是我在default.nix 中尝试过的corepack enable,但它不起作用。

with import <nixpkgs> {};

stdenv.mkDerivation {
  name = \"dev\";
  dontUnpack = true;
  buildInputs = [ nodejs-17_x ];
  postPhases = \'\'
    corepack enable
  \'\';
}

    标签: nix nix-shell


    【解决方案1】:

    对于通过搜索引擎来到这里的其他人:)

    corepack enable
    
    corepack prepare yarn@3.2.2 --activate
    

    (安装符号链接需要enable,并准备+激活设置正确的版本。)

    这应该适用于 v16.9.0+(甚至 v14.19.0+)

    来源:https://nodejs.org/api/corepack.html#upgrading-the-global-versions

    【讨论】:

      猜你喜欢
      • 2020-12-03
      • 2022-11-03
      • 2020-08-12
      • 2022-01-02
      • 2020-11-09
      • 2021-10-07
      • 1970-01-01
      • 2022-11-25
      • 2021-08-03
      相关资源
      最近更新 更多