Ubuntu24.04.3执行sudo apt install yarnpkg 命令失败的原因

安装yarnpkg:

sudo apt-get update   

sudo apt install yarnpkg

安装成功。

执行命令:执行 yarnpkg --cwd  vendor/adevtool/ install

报错:

error log-update@7.0.1: The engine "node" is incompatible with this module. Expected version ">=20". Got "18.19.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

那好吧,升级node到20以上,执行如下:

sudo apt update
sudo apt install curl
curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -


sudo apt install nodejs
 

验证安装: 
node -v
v20.19.6

参考地址:https://comate.baidu.com/zh/page/dv43dn0ek14

好了,升级完了,再次执行yarnpkg --cwd

报错:

找不到命令 “yarnpkg”,但可以通过以下软件包安装它:
sudo apt install yarnpkg

执行:sudo apt install yarnpkg

报错:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 yarnpkg : Depends: node-chalk but it is not going to be installed
           Depends: node-cli-table but it is not going to be installed
           Depends: node-debug but it is not going to be installed
           Depends: node-deep-equal but it is not going to be installed
           Depends: node-emoji but it is not going to be installed
           Depends: node-imports-loader but it is not going to be installed
           Depends: node-inquirer but it is not going to be installed
           Depends: node-invariant but it is not going to be installed
           Depends: node-js-yaml (>= 3.13.1) but it is not going to be installed
           Depends: node-micromatch but it is not going to be installed
           Depends: node-mkdirp (>= 1.0~) but it is not going to be installed
           Depends: node-proper-lockfile but it is not going to be installed
           Depends: node-puka but it is not going to be installed
           Depends: node-request (>= 2.88.1-5~) but it is not going to be installed
           Depends: node-request-capture-har but it is not going to be installed
           Depends: node-rimraf but it is not going to be installed
           Depends: node-semver but it is not going to be installed
           Depends: node-strip-ansi but it is not going to be installed
           Depends: node-yn but it is not going to be installed
           Depends: nodejs:any
E: Unable to correct problems, you have held broken packages.

根据您提供的错误信息,sudo apt install yarnpkg 命令失败的原因是依赖项未满足。以下是解决方案:
1. ‌更新包列表并修复依赖关系‌

sudo apt update
sudo apt install -f  # 修复损坏的依赖关系

2. ‌安装缺失的 Node.js 依赖‌

Yarn 依赖于 Node.js,但系统可能未安装或版本不兼容。建议使用 Node 版本管理器(如 nvm)安装 Node.js:

bash
# 安装 nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
source ~/.bashrc  # 或 source ~/.zshrc

# 安装 Node.js(建议 LTS 版本)
nvm install --lts

验证安装版本:

node -v
v24.12.0

3. ‌重新安装 Yarn‌

安装 Node.js 后,重新尝试安装 Yarn:

bash
sudo apt install yarnpkg   (失败)

4. ‌使用 npm 安装 Yarn(备选方案)‌

如果系统包管理器仍无法安装,可使用 npm 安装:

bash
npm install -g yarn
added 1 package in 2s  (成功)

### 启动通过 `apt-get` 安装的 MinIO 对于在 Ubuntu 24.04.1 LTS 上使用 `apt-get` 安装后的 MinIO,启动服务可以通过系统的 systemd 来管理。确保已经成功安装了 MinIO 并配置好环境变量。 #### 使用 Systemd 启动 MinIO MinIO 可以作为系统服务运行,在大多数现代 Linux 发行版中推荐这种方式来管理和控制其生命周期。下面是如何设置并启动 MinIO 的具体操作: 为了使 MinIO 能够随系统自动启动,创建一个新的 service 文件 `/etc/systemd/system/minio.service`[^3]: ```bash sudo nano /etc/systemd/system/minio.service ``` 向文件内写入如下内容以便定义 MinIO 服务的行为: ```ini [Unit] Description=MinIO Documentation=https://docs.min.io Wants=network-online.target After=network-online.target [Service] User=minio Group=minio EnvironmentFile=-/etc/default/minio ExecStart=/usr/bin/env minio server $MINIO_VOLUMES --console-address ":9001" Restart=on-failure RestartSec=5s [Install] WantedBy=default.target ``` 上述命令中的 `$MINIO_VOLUMES` 应该指向存储数据的位置;而 `--console-address ":9001"` 则指定了 Web 控制台监听端口为 9001。如果希望更改这些参数,则需编辑对应的环境变量文件 `/etc/default/minio` 或者直接修改此 `.service` 文件内的相应部分[^3]。 完成以上步骤之后,重新加载 systemd 配置使得新添加的服务生效,并尝试启动 MinIO: ```bash sudo systemctl daemon-reload sudo systemctl start minio ``` 最后一步是为了让 MinIO 在每次开机时都能自启: ```bash sudo systemctl enable minio ``` 此时 MinIO 已经被正确设置了作为一个后台守护进程工作于 Ubuntu 24.04.1 LTS 中。 #### 检查 MinIO 运行状态 可以利用以下指令查看 MinIO 是否正常运作以及获取更多关于当前实例的信息: ```bash sudo systemctl status minio ``` 这会显示有关 MinIO 服务的状态详情,包括它是否正在运行、最后一次重启的时间等有用的数据。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值