无法通过 nodesource/distributions 在 ubuntu22 上安装 nodejs16/18/20?-灵析社区

走你啊啊啊啊啊

参考:[https://github.com/nodesource/distributions](https://link.segmentfault.com/?enc=T9cPjhDy5QPYlqHGJ9bFYg%3D%3D.1Vmn3KSXv%2BCcBkco%2B3LhBLpYgjYXL%2FV5b7pbD0qnxl%2Fgh80EjLG6qFO9KrnHnNEt) docker pull ubuntu:22.04 docker run --rm -it ubuntu:22.04 bash apt-get update apt-get install -y ca-certificates curl gnupg mkdir -p /etc/apt/keyrings curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg NODE_MAJOR=16; echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list apt-get update apt-get install nodejs npm -y 报错 137 added, 0 removed; done. Setting up gpg-wks-server (2.2.27-3ubuntu2.1) ... Setting up libcurl4:amd64 (7.81.0-1ubuntu1.13) ... Setting up curl (7.81.0-1ubuntu1.13) ... Setting up gpg-wks-client (2.2.27-3ubuntu2.1) ... Setting up gnupg (2.2.27-3ubuntu2.1) ... Processing triggers for libc-bin (2.35-0ubuntu3.1) ... Processing triggers for ca-certificates (20230311ubuntu0.22.04.1) ... Updating certificates in /etc/ssl/certs... 0 added, 0 removed; done. Running hooks in /etc/ca-certificates/update.d... done. deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease Hit:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease Get:3 https://deb.nodesource.com/node_16.x nodistro InRelease [12.1 kB] Hit:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease Get:5 https://deb.nodesource.com/node_16.x nodistro/main amd64 Packages [7253 B] Hit:6 http://security.ubuntu.com/ubuntu jammy-security InRelease Fetched 19.4 kB in 6s (3210 B/s) Reading package lists... Done 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: nodejs : Conflicts: npm npm : Depends: node-cacache but it is not going to be installed Depends: node-gyp but it is not going to be installed Depends: node-mkdirp but it is not going to be installed Depends: node-nopt but it is not going to be installed Depends: node-tar but it is not going to be installed Depends: node-which but it is not going to be installed Depends: nodejs:any (>= 10) Recommends: git but it is not going to be installed Recommends: node-tap but it is not going to be installed E: Unable to correct problems, you have held broken packages.

阅读量:323

点赞量:16

问AI
nodejs这个包里面已经有npm了。 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241219/e989cf51d56ecacc72a275f6cc768987.png) *** "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241219/36f12c8e1de7e34aff1e4f7f5e398763.png) "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241219/2951d148e25fc296a292965111c5d3af.png) npm这个包,ubuntu默认的仓库里面默认就有,这个包和nodesource仓库里面冲突应该不算意外。