我正在尝试安装 nodejs-legacy 但一直失败

我正在尝试安装 nodejs-legacy 但一直失败

我不知道问题出在哪里,但我一直尝试通过运行 sudo apt-get install 来安装 nodejs-legacy,但总是失败。以下是我尝试执行该命令时的所有输出。

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  ax25-node libax25 libc-ares2 libv8-3.14.5 openbsd-inetd
Use 'apt-get autoremove' to remove them.
The following NEW packages will be installed:
  nodejs-legacy
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
1 not fully installed or removed.
Need to get 0 B/15.4 kB of archives.
After this operation, 119 kB of additional disk space will be used.
(Reading database ... 198807 files and directories currently installed.)
Unpacking nodejs-legacy (from .../nodejs-legacy_0.10.15~dfsg1-4_all.deb) ...
dpkg: error processing /var/cache/apt/archives/nodejs-legacy_0.10.15~dfsg1-4_all.deb (--unpack):
 trying to overwrite '/usr/share/man/man1/node.1.gz', which is also in package nodejs 0.10.24-1chl1~saucy1
Processing triggers for man-db ...
Errors were encountered while processing:
 /var/cache/apt/archives/nodejs-legacy_0.10.15~dfsg1-4_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

解决方案:

所以我在另一个帖子中找到了问题的答案。我必须使用sudo dpkg -r nodejs-legacysudo apt-get -f install

因此,值得赞扬的是,这里是链接,答案向我解释了我必须做什么。

https://askubuntu.com/a/185123/237774

答案1

尝试删除以前安装的nodejs包,然后安装nodejs-legacy包。

sudo dpkg -r nodejs
sudo apt-get install nodejs-legacy

相关内容