【问题标题】:yarn dependency, nodejs, is removed during installation of yarn, and vice versa?纱线依赖,nodejs,在安装纱线期间被删除,反之亦然?
【发布时间】:2017-09-14 10:52:27
【问题描述】:

尝试使用 yarn 安装包,但我收到错误消息说我需要 nodejs,但安装 nodejs 会删除纱线。同样,当我安装纱线时,nodejs 被删除。我错过了什么?

$ yarn install some-package
Yarn requires Node.js 4.0 or higher to be installed.

$ curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
...
...
$ sudo apt-get install -y nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp libc-ares-dev libjs-node-uuid libv8-3.14-dev
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  yarn
The following NEW packages will be installed:
  nodejs
...

$ sudo apt-get install yarn
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp libc-ares-dev libjs-node-uuid libv8-3.14-dev
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  nodejs
The following NEW packages will be installed:
  yarn
...

【问题讨论】:

    标签: node.js debian yarnpkg


    【解决方案1】:

    我在尝试在 WSL 上安装 Yarn 和 NodeJS 时遇到了这个问题。以下是我为使其工作而采取的步骤:

    apt-get remove node
    apt-get remove yarn
    
    curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    sudo apt-get install -y nodejs
    
    curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
    echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
    sudo apt-get update && sudo apt-get install yarn
    

    【讨论】:

      【解决方案2】:

      nodejs 在您的发行版中可能很旧,最好从node.js 站点安装。

      一旦你有了新版本的 node.js,你可以直接npm install -g yarn 来安装 yarn,或者你喜欢的任何其他方法。

      【讨论】:

      • @JoeClay 是的,我知道,但 OP 无法通过“推荐方式”安装。请注意,我说他可以尝试通过 npm 或他/她喜欢的任何其他方法安装(在解决旧版本节点的问题之后)
      • 我不认为他们完全遵循推荐的方式,但是?他们似乎试图从 NodeSource 存储库中获取 Node 和 Yarn,而说明说从 NodeSource 获取 Node,从他们自己的 repo (https://dl.yarnpkg.com/debian/) 获取 Yarn。不过,也许他们只是把这部分排除在外。
      猜你喜欢
      • 2021-12-13
      • 1970-01-01
      • 2020-02-20
      • 1970-01-01
      • 2020-04-03
      • 2019-12-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多