我正在尝试从here在Linux的Windows子系统上安装sbt。以下是我的bash终端输出:

username:repo$ echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
deb https://dl.bintray.com/sbt/debian /
username:repo$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
Executing: /tmp/apt-key-gpghome.NbSR0JqpKB/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
gpg: connecting dirmngr at '/tmp/apt-key-gpghome.NbSR0JqpKB/S.dirmngr' failed: IPC connect call failed
gpg: keyserver receive failed: No dirmngr


我检查了是否已安装dirmngr。 sudo apt-get update提供以下输出:

Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Ign:4 https://dl.bintray.com/sbt/debian  InRelease
Get:5 https://dl.bintray.com/sbt/debian  Release [815 B]
Get:6 https://dl.bintray.com/sbt/debian  Release.gpg [821 B]
Hit:7 http://security.ubuntu.com/ubuntu bionic-security InRelease
Ign:6 https://dl.bintray.com/sbt/debian  Release.gpg
Reading package lists... Done
W: GPG error: https://dl.bintray.com/sbt/debian  Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 99E82A75642AC823
E: The repository 'https://dl.bintray.com/sbt/debian  Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details


sudo apt-get install sbt的输出:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package sbt


我已经看过this similar question about installing crystal,但是不知道如何将解决方案应用于这种情况。

最佳答案

这是WSL错误,请参见此workaround

您只需要更改十六进制值。因此,对于SBT,它将是:

curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add


PS:请注意此命令旨在替代以下命令

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823


如您所见,两个十六进制值都相同。 (除了在第一个中,您在0x前面添加了,用于表示以下是十进制值)。
因此,此解决方法可以应用于任何密钥。

关于scala - WSL上的sbt安装失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/52469819/

10-16 17:35