如何在本地安装yarn而不添加任何依赖

问题描述 投票:0回答:2

使用 dnf 安装yarn会在我的机器上安装几个我不想要的软件包。

$ sudo dnf install yarnpkg-1.22.19-5.fc37.noarch 
Last metadata expiration check: 1:08:38 ago on Sat 17 Feb 2024 09:01:36 PM PST.
Dependencies resolved.
==============================================================================================================================================================
 Package                                 Architecture                  Version                                           Repository                      Size
==============================================================================================================================================================
Installing:
 yarnpkg                                 noarch                        1.22.19-5.fc37                                    updates                        5.3 M
Installing dependencies:
 nodejs                                  x86_64                        1:18.18.2-1.fc37                                  updates                        2.2 M
 nodejs-libs                             x86_64                        1:18.18.2-1.fc37                                  updates                         14 M
Installing weak dependencies:
 nodejs-docs                             noarch                        1:18.18.2-1.fc37                                  updates                        7.7 M
 nodejs-full-i18n                        x86_64                        1:18.18.2-1.fc37                                  updates                        8.5 M
 nodejs-npm                              x86_64                        1:9.8.1-1.18.18.2.1.fc37                          updates                        2.3 M

Transaction Summary
==============================================================================================================================================================
Install  6 Packages

Total download size: 40 M
Installed size: 203 M
Is this ok [y/N]: 

例如,我的主目录中已经有来自 nvm 的节点和 npm

~/.nvm/versions/node/v16.13.0/bin/npm

node.js package yarnpkg fedora
2个回答
0
投票

您可以直接通过npm安装yarn,如官方文档中所述

https://classic.yarnpkg.com/lang/en/docs/install


0
投票

CentOS / Fedora / RHEL

在 CentOS、Fedora 和 RHEL 上,您可以通过 RPM 软件包存储库安装 Yarn。

curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo

如果您尚未安装 Node.js,您还应该配置 NodeSource 存储库:

curl --silent --location https://rpm.nodesource.com/setup_12.x | sudo bash -

然后您可以简单地:

sudo yum install yarn
## OR ##
sudo dnf install yarn
© www.soinside.com 2019 - 2024. All rights reserved.