plu*_*ium 6 apt nodejs software-installation
I just installed Ubuntu 22.04 a few days ago. My laptop is almost entirely blank. So I am met with confusion when I try to install Nodejs using these DigitalOcean instructions and I get an error.
I do:
sudo apt update
sudo apt install nodejs
Run Code Online (Sandbox Code Playgroud)
The second command gives
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 7 not upgraded.
Need to get 0 B/26.4 MB of archives.
After this operation, 124 MB of additional disk space will be used.
(Reading database ... 197872 files and directories currently installed.)
Preparing to unpack .../nodejs_16.15.1-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (16.15.1-deb-1nodesource1) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_16.15.1-deb-1nodes
ource1_amd64.deb (--unpack):
trying to overwrite '/usr/share/systemtap/tapset/node.stp', which is also in pa
ckage libnode72:amd64 12.22.9~dfsg-1ubuntu3
Errors were encountered while processing:
/var/cache/apt/archives/nodejs_16.15.1-deb-1nodesource1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)
I am new to Ubuntu so I can't read this message, or at least I can't tell what's useful etc.
我在这里使用 Google 发现了类似的错误消息,并按照页面上的说明进行操作。
// Delete the new package source.
cd /etc/apt/sources.list.d
sudo rm nodesource.list
// Update apt, fix the install, remove nodeJS and the nodejs-doc packages.
sudo apt --fix-broken install
sudo apt update
sudo apt remove nodejs
sudo apt remove nodejs-doc
// then use the instructions to install the latest node
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
Run Code Online (Sandbox Code Playgroud)
但这给了我相同或类似的错误
sudo apt-get install -y 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 7 not upgraded.
Need to get 0 B/26.4 MB of archives.
After this operation, 124 MB of additional disk space will be used.
(Reading database ... 197872 files and directories currently installed.)
Preparing to unpack .../nodejs_16.15.1-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (16.15.1-deb-1nodesource1) ...
dpkg: error processing archive /var/cache/apt/archives/nodejs_16.15.1-deb-1nodesource1_amd64.deb (--unpack):
trying to overwrite '/usr/share/systemtap/tapset/node.stp', which is also in package libnode72:amd64 12.22.9~dfsg-1ubuntu3
Errors were encountered while processing:
/var/cache/apt/archives/nodejs_16.15.1-deb-1nodesource1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)
有什么建议么?求求你了,谢谢你
从您尝试安装的nodejs版本(16.15)来看,您似乎没有从Ubuntu 22.04发行版安装nodejs,其中当前版本为12.22。
除非您有特定原因要安装发行版外的版本,否则您可以删除添加的文件/etc/apt/sources.list.d/以获得 16.15 版本,然后运行apt update && apt install nodejs安装 12.22。
如果您坚持使用发行版之外的较新版本,请首先使用apt autoremove(按照apt建议)删除 Ubuntu 默认版本的残余内容,然后再次尝试安装。
| 归档时间: |
|
| 查看次数: |
5515 次 |
| 最近记录: |