如何修复错误 E:子进程 /usr/bin/dpkg 返回错误代码 (1)

如何修复错误 E:子进程 /usr/bin/dpkg 返回错误代码 (1)
sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mawk (1.3.3-17ubuntu3) ...
update-alternatives: error: cannot stat file '/usr/bin/nodejs': Too many levels of symbolic links
dpkg: error processing package mawk (--configure):
 installed mawk package post-installation script subprocess returned error exit status 2
Setting up gawk (1:4.1.4+dfsg-1build1) ...
update-alternatives: error: cannot stat file '/usr/bin/nodejs': Too many levels of symbolic links
dpkg: error processing package gawk (--configure):
 installed gawk package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 mawk
 gawk
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

尝试使用以下方法移除有问题的 NodeJS 可执行文件

sudo mv /usr/bin/nodejs ~/nodejs_broken

然后恢复你的操作

sudo apt-get install -f

并使用以下方法重新安装 NodeJS

sudo apt-get install --reinstall nodejs

相关内容