尝试安装带有纱线的包装,但我得到并且错误地说我需要nodejs,但安装nodejs会移除纱线。同样,当我安装yarn时,会删除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
...
答案 0 :(得分:6)
我在尝试在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
答案 1 :(得分:2)
包nodejs
可能在您的发行版中非常陈旧,可以从node.js网站更好地安装。
拥有node.js的新版本后,您只需npm install -g yarn
即可安装纱线或任何其他您喜欢的方法。