node.js 安装 Yarn Ubuntu 16.04 (Linux Mint 18.1)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42606941/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Install Yarn Ubuntu 16.04 (Linux Mint 18.1)
提问by Jose
I have a new installation of Linux Mint 18.1 with Ubuntu 16.04. I have installed Node 6.10.0.
我在 Ubuntu 16.04 上新安装了 Linux Mint 18.1。我已经安装了 Node 6.10.0。
When doing the command that indicates the documentation of Yarn:
在执行指示 Yarn 文档的命令时:
sudo apt-get update && sudo apt-get install yarn
It says "could not find yarn package"
它说“找不到纱线包”
I must do something else, because in the documentation I do not see anything about it.
我必须做其他事情,因为在文档中我没有看到任何关于它的内容。
Thank you.
谢谢你。
回答by Shaig Khaligli
On Ubuntu Linux, you can install Yarn via Debian package repository. You will first need to configure the repository:
在 Ubuntu Linux 上,您可以通过 Debian 软件包存储库安装 Yarn。您首先需要配置存储库:
curl -sS 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
Then you can simply:
然后你可以简单地:
sudo apt-get update && sudo apt-get install yarn
More information here
更多信息在这里
回答by ow3n
I was unable to install Yarn on Ubuntu 16.04 using the accepted answer but found it easy with npm:
我无法使用接受的答案在 Ubuntu 16.04 上安装 Yarn,但发现使用 npm 很容易:
npm install -g yarn
npm install -g yarn
Then check install / version with
然后检查安装/版本
yarn --version
yarn --version
回答by simhumileco
See on Installation | Yarn | Linux tab
There are instructions for several linux distributions
有几个linux发行版的说明
回答by themefield
Here are more details about the official install instruction.
以下是有关官方安装说明的更多详细信息。
apt-keycommand gets the public authentication key for software integration check.deb https://dl.yarnpkg.com/debian/ stable mainis the Ubuntu repository containingyarn. Look at OP's screenshot, the top 10 lines list existing repositories to search for packages, but there is no yarn's one. So we need to add the repository by creating file/etc/apt/sources.list.d/yarn.list.After the above two steps, issue
apt/apt-getcommand to addyarnlike usual Ubuntu packages.
apt-key命令获取用于软件集成检查的公共身份验证密钥。deb https://dl.yarnpkg.com/debian/ stable main是包含yarn. 看 OP 的截图,前 10 行列出了现有的存储库以搜索包,但没有 yarn 的一个。所以我们需要通过创建文件来添加存储库/etc/apt/sources.list.d/yarn.list。完成以上两步后,像往常一样发出
apt/apt-get命令来添加yarnUbuntu 包。
回答by Alex Varghese
In Ubuntu or Linux you can install yarn using terminal ,But before installing You will first need to configure the repository, for that run the below commands
在 Ubuntu 或 Linux 中,您可以使用终端安装 yarn,但在安装之前您首先需要配置存储库,为此运行以下命令
sudo apt install curl
curl -sS 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
after setting up the repository you can simply install yarn using below command
设置存储库后,您可以使用以下命令简单地安装纱线
sudo apt-get update && sudo apt-get install yarn
Once the installation gets completed you can check the version using following command
安装完成后,您可以使用以下命令检查版本
yarn --version
回答by classnotes101
Be careful when using &&. I get the same error when running sudo apt-get update, which prevents terminal from running sudo apt-get install yarn. I was able to successfully install yarn on Ubuntu 16.04 by running these commands separately (without using &&)
使用时要小心&&。我在运行时遇到同样的错误sudo apt-get update,这阻止了终端运行sudo apt-get install yarn。通过单独运行这些命令(不使用&&),我能够在 Ubuntu 16.04 上成功安装 yarn


