当我尝试安装 npm 时出现以下情况
无法获取 http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.0.2d-0ubuntu1.5_amd64.deb 404 未找到 [IP: 91.189.88.149 80]
请更新您的包裹清单:
apt-get update
libssl-dev
的当前版本是1.0.2g-1ubuntu4.11(请参阅Ubuntu软件包)。
旧版本的软件包一旦过时足够长的时间,就会从 ubuntu 存储库中删除。拉取新的软件包信息后,软件包管理器将安装新版本。
我以前也遇到过这个错误。
$ sudo apt install python3-pip
...
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_5.15.0-88.98_amd64.deb
404 Not Found [IP: 185.125.190.39 80]
如果我尝试更新 apt,我会收到如下错误:
$ sudo apt update
...
E: Release file for http://archive.ubuntu.com/ubuntu/dists/jammy-updates
/InRelease is not valid yet (invalid for another 19min 41s). Updates for
this repository will not be applied.
就我而言,问题是 WSL2 Ubuntu 和 Windows 系统时钟不同步。
$ timedatectl
Local time: Wed 2023-11-29 12:14:28 EST
Universal time: Wed 2023-11-29 17:14:28 UTC
RTC time: Wed 2023-11-29 19:15:21
Time zone: America/New_York (EST, -0500)
System clock synchronized: no
NTP service: inactive
RTC in local TZ: no
重新同步时钟后,我就可以完成apt的更新和软件包的安装了。
$ sudo hwclock -s
$ sudo apt update
$ sudo apt install python3-pip