大网数据广告活动
服务器运维问答

Library Error while installing NPM on Ubuntu 22.04 LTS

· 52CE 我爱测

I'm trying to install NPM on Ubuntu 22.04 LTS; How can I fix this problem? Step 1: user@ubuntu:~$ sudo apt-get update Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease Reading package lists... Done user@ubuntu:~$ sudo apt up…

问题原文

原帖链接 · Andre · CC BY-SA 4.0

I'm trying to install NPM on Ubuntu 22.04 LTS;

How can I fix this problem?

Step 1:

user@ubuntu:~$ sudo apt-get update              
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease                    
    Reading package lists... Done

user@ubuntu:~$ sudo apt update
Hit:1 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 https://repo.protonvpn.com/debian stable InRelease                  
Hit:3 http://archive.ubuntu.com/ubuntu jammy InRelease                    
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
atenreiro@stellar:~$ 

Step 2:

user@ubuntu:~$ sudo apt-get install npm
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:
 libssl-dev : Depends: libssl3 (= 3.0.2-0ubuntu1) but 3.0.2-0ubuntu1.6 is to be installed
E: Unable to correct problems, you have held broken packages.
user@ubuntu:~$ 

Step 3:

user@ubuntu:~$ sudo apt-get install libssl3
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libssl3 is already the newest version (3.0.2-0ubuntu1.6).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
user@ubuntu:~$ 

Step 4:

user@ubuntu:~$ sudo apt show libssl-dev -a
Package: libssl-dev
Version: 3.0.2-0ubuntu1
Priority: optional
Section: libdevel
Source: openssl
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email omitted]>
Original-Maintainer: Debian OpenSSL Team <[email omitted]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 12.4 MB
Depends: libssl3 (= 3.0.2-0ubuntu1)
Suggests: libssl-doc
Conflicts: libssl1.0-dev
Homepage: https://www.openssl.org/
Download-Size: 2,372 kB
APT-Sources: http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages
Description: Secure Sockets Layer toolkit - development files
 This package is part of the OpenSSL project's implementation of the SSL
 and TLS cryptographic protocols for secure communication over the
 Internet.
 .
 It contains development libraries, header files, and manpages for libssl
 and libcrypto.

user@ubuntu

Step 5:

user@ubuntu:~$ cat /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu jammy main universe restricted
user@ubuntu:~$

已采纳解答

原帖链接 · Gerald Schneider · CC BY-SA 4.0

Looks like you are missing the updates channel.

When I run apt show libssl-dev -a I get two versions of the package listed:

Package: libssl-dev
Version: 3.0.2-0ubuntu1.6
Depends: libssl3 (= 3.0.2-0ubuntu1.6)
APT-Sources: http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages

Package: libssl-dev
Version: 3.0.2-0ubuntu1
Depends: libssl3 (= 3.0.2-0ubuntu1)
APT-Sources: http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages

(output reduced to the minimum for brevity)

As you can see, the the package version you are using is from the regular channel and the wanted version is from jammy-updates.

Add the channel to your sources.list:

deb http://archive.ubuntu.com/ubuntu/ jammy-updates main universe restricted

And while you are at it, you may also want to add jammy-security.

deb http://security.ubuntu.com/ubuntu/ jammy-security main universe restricted

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-09-23)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。