在 Debian 上安装 Nodejs 时出错

在 Debian 上安装 Nodejs 时出错

我正在尝试在 Debian Docker 容器上安装 Node(特别是基于 nginx 映像)。我检查了正确的安装脚本以从nodesource获取版本6.x,但是一旦将签名密钥添加到密钥环,该过程的curl部分就会出错。我对这种级别的服务器设置并不是特别有经验,并且以某种方式搜索我的错误并没有给我任何好的线索。

在 apt-get 更新和升级并安装 sudo 和 curl 之后,我尝试执行以下命令:

sudo curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -

最终总是这样:

## Adding the NodeSource signing key to your keyring...

+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation
(23) Failed writing body
Error executing command, exiting

这些程序中哪些是首选版本?我假设这些是同一事物的升级或变体。我不记得尝试以这种方式安装节点时在其他系统上遇到过此错误。不同版本的 Debian 是否可以gnupg以可接受的方式安装其中一个?

答案1

我有同样的问题。添加gnupg到apt install就ok了:

RUN apt install -y curl software-properties-common gnupg
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN apt install -y nodejs
RUN apt install -y build-essential libssl-dev

RUN node -v
RUN npm -v

相关内容