TL;DR
nodejs
需要安装libssl1.0-dev
,但当已经安装了libcurl4-openssl-dev
或libssl-dev
时,无法安装。
解决方法是卸载libcurl4-openssl-dev
和libssl-dev
,或安装libssl1.0-dev
以强制删除其他两个软件包。
完整故事
我也遇到了同样的问题,所以我尝试手动安装每个被抱怨的软件包。
$ sudo apt install npm
...
The following packages have unmet dependencies:
npm : Depends: node-gyp (>= 0.10.9) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
$ sudo apt install node-gyp
...
The following packages have unmet dependencies:
node-gyp : Depends: nodejs-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
$ sudo apt install nodejs-dev
...
The following packages have unmet dependencies:
nodejs-dev : Depends: libssl1.0-dev (>= 1.0.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
$ sudo apt install libssl1.0-dev
...
The following packages will be REMOVED:
libcurl4-openssl-dev libssl-dev
The following NEW packages will be installed:
libssl1.0-dev
0 to upgrade, 1 to newly install, 2 to remove and 0 not to upgrade.
Need to get 1,364 kB of archives.
After this operation, 1,017 kB disk space will be freed.
Do you want to continue? [Y/n] y
Get:1 http://au.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libssl1.0-dev amd64 1.0.2n-1ubuntu5.1 [1,364 kB]
Fetched 1,364 kB in 4s (368 kB/s)
(Reading database ... 323301 files and directories currently installed.)
Removing libcurl4-openssl-dev:amd64 (7.58.0-2ubuntu3.3) ...
Removing libssl-dev:amd64 (1.1.0g-2ubuntu4.1) ...
Selecting previously unselected package libssl1.0-dev:amd64.
(Reading database ... 323196 files and directories currently installed.)
Preparing to unpack .../libssl1.0-dev_1.0.2n-1ubuntu5.1_amd64.deb ...
Unpacking libssl1.0-dev:amd64 (1.0.2n-1ubuntu5.1) ...
Setting up libssl1.0-dev:amd64 (1.0.2n-1ubuntu5.1) ...
Processing triggers for man-db (2.8.3-2) ...
看这里:
$ sudo apt install npm
...
The following additional packages will be installed:
gyp libc-ares2 libhttp-parser2.7.1 libjs-async libjs-inherits libjs-node-uuid libuv1 libuv1-dev node-abbrev node-ansi node-ansi-color-table node-archy node-async node-balanced-match node-block-stream
node-brace-expansion node-builtin-modules node-combined-stream node-concat-map node-cookie-jar node-delayed-stream node-forever-agent node-form-data node-fs.realpath node-fstream node-fstream-ignore
node-github-url-from-git node-glob node-graceful-fs node-gyp node-hosted-git-info node-inflight node-inherits node-ini node-is-builtin-module node-isexe node-json-stringify-safe node-lockfile
node-lru-cache node-mime node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt node-normalize-package-data node-npmlog node-once node-osenv node-path-is-absolute node-pseudomap node-qs
node-read node-read-package-json node-request node-retry node-rimraf node-semver node-sha node-slide node-spdx-correct node-spdx-expression-parse node-spdx-license-ids node-tar node-tunnel-agent
node-underscore node-validate-npm-package-license node-which node-wrappy node-yallist nodejs nodejs-dev nodejs-doc
Suggested packages:
node-hawk node-aws-sign node-oauth-sign node-http-signature
The following NEW packages will be installed:
gyp libc-ares2 libhttp-parser2.7.1 libjs-async libjs-inherits libjs-node-uuid libuv1 libuv1-dev node-abbrev node-ansi node-ansi-color-table node-archy node-async node-balanced-match node-block-stream
node-brace-expansion node-builtin-modules node-combined-stream node-concat-map node-cookie-jar node-delayed-stream node-forever-agent node-form-data node-fs.realpath node-fstream node-fstream-ignore
node-github-url-from-git node-glob node-graceful-fs node-gyp node-hosted-git-info node-inflight node-inherits node-ini node-is-builtin-module node-isexe node-json-stringify-safe node-lockfile
node-lru-cache node-mime node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt node-normalize-package-data node-npmlog node-once node-osenv node-path-is-absolute node-pseudomap node-qs
node-read node-read-package-json node-request node-retry node-rimraf node-semver node-sha node-slide node-spdx-correct node-spdx-expression-parse node-spdx-license-ids node-tar node-tunnel-agent
node-underscore node-validate-npm-package-license node-which node-wrappy node-yallist nodejs nodejs-dev nodejs-doc npm
0 to upgrade, 74 to newly install, 0 to remove and 0 not to upgrade.
Need to get 8,422 kB of archives.
After this operation, 40.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y