无法在ubuntu 22.04上安装nodejs

jecbmhm3  于 2022-12-22  发布在  其他
关注(0)|答案(1)|浏览(619)

我尝试在我的虚拟机上安装NodeJS LTS,但是ubuntu(22.04)抛出了一个错误
错误:

root@web-server ~/server# sudo apt list nodejs
Listing... Done
nodejs/unknown 18.12.0-deb-1nodesource1 arm64
N: There is 1 additional version. Please use the '-a' switch to see it
root@web-server ~/server# sudo apt install nodejs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  javascript-common libc-ares2 libjs-highlight.js libnode72
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  nodejs
0 upgraded, 1 newly installed, 0 to remove and 93 not upgraded.
Need to get 0 B/27.8 MB of archives.
After this operation, 180 MB of additional disk space will be used.
(Reading database ... 83553 files and directories currently installed.)
Preparing to unpack .../nodejs_18.12.0-deb-1nodesource1_arm64.deb ...
Unpacking nodejs (18.12.0-deb-1nodesource1) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_18.12.0-deb-1nodesource1_arm64.deb (--unpack):
 trying to overwrite '/usr/share/systemtap/tapset/node.stp', which is also in package libnode72:arm64 12.22.9~dfsg-1ubuntu3
Errors were encountered while processing:
 /var/cache/apt/archives/nodejs_18.12.0-deb-1nodesource1_arm64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@web-server ~/server [100]#

我多次尝试删除并再次安装它,但没有任何React

q8l4jmvw

q8l4jmvw1#

点击此链接:Github Error solved link

并使用下面给出的命令重新安装nodejs

已在Ubuntu 22.04上成功安装Nodejs版本-12.22.9

sudo apt update
sudo apt install nodejs

系统提示确认安装时,请按Y。如果系统提示您重新启动任何服务,请按Enter接受默认值并继续。通过查询节点的版本号来检查安装是否成功:

node -v

产出

v 12.22.9

相关问题