当前位置: 首页 > news >正文

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(成功)

http://www.cnnetsun.cn/news/134786.html

相关文章:

  • FLORIS风电场仿真实战:从入门到精通的终极指南
  • 机器学习图表设计专家:快速创建专业级科研可视化
  • 惠普游戏本终极性能控制指南:OmenSuperHub完全实战教程
  • 煤矿高压电缆绝缘监测技术深度解析:从局部放电到智能预警的科技防线
  • 收藏必备!LangGraph核心概念详解:从思维链到多智能体,一文掌握大模型应用架构
  • python-flask-django大学生健康管理系统_35l867i9
  • python-flask-django宠物商城 论坛领养系统_07ggc7q2
  • 46、《Linux使用技巧与技术综合指南》
  • SSLUnpinning_Xposed:Android安全测试终极指南
  • Kotaemon本地化部署方案:满足数据不出境要求
  • Blynk物联网开发完全指南:从零到一的智能硬件实战教程
  • 终极指南:如何彻底卸载Windows 10中的OneDrive
  • 这个”AI超级工程师“,已经帮2000多家企业省了27亿度电了!
  • ArtPlayer实战指南:打造高效Web视频播放解决方案的完整方法
  • 工业互联网数据采集网关是什么
  • 终极指南:使用urdf-viz快速实现URDF可视化
  • 如何在10分钟内快速搭建MosDNS:打造高性能DNS转发器的完整教程
  • AI时代的思考力:程序员构建个人知识体系的完整路径!
  • 2025年大模型学习路线图:从零基础到精通,AI智能体教程带你探索LLMs与智能体AI的新世界!
  • 基于大语言模型的产量预测方法
  • 当开题报告还在“憋字”?不如让AI帮你搭好科研第一块积木
  • Upscayl终极指南:免费开源AI图像放大工具完全使用教程
  • SeaTunnel Web深度体验:企业级数据集成平台的可视化革命
  • Moonraker:简单易用的3D打印控制API服务器完整指南
  • 办公管理系统
  • Charticulator完全指南:从零开始掌握交互式图表定制
  • Netflix画质提升技巧:3步解锁4K超高清观影体验
  • Flow Launcher文件替换异常终极解决方案:从崩溃到稳定的完整修复指南
  • 3分钟快速上手:让你的电脑拥有苹果风格鼠标指针
  • 浙江比较好的港澳台联考公司有哪些