ghcup 安装:写入 ~/.ghcup/cache 目录时权限被拒绝

Aus*_*n T 5 permissions curl haskell ghcup

我尝试在 Ubuntu 上安装 ghcup:

curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

使用默认选项(添加到 .bashrc 之前,不安装 HLS,不安装 Stack)。

问题是,permission denied当脚本尝试将ghcup-0.0.6.yaml.tmp文件写入~/.ghcup/cache目录时,我收到错误,但我不确定原因。

该目录的权限为 1775 (drwxrwxr-x)。将它们升级到 1777 (drwxrwxrwt) 并重新运行curl 命令会产生相同的错误。目录所有者是我(不是 root),并且我正在运行 curl 命令,而没有sudo按照 ghcup 安装说明的指示。

完整命令输出:

                                 Dload  Upload   Total   Spent    Left  Speed
100 24.3M  100 24.3M    0     0  5782k      0  0:00:04  0:00:04 --:--:-- 5783k
[ Info  ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.6.yaml as file /home/austin/.ghcup/cache/ghcup-0.0.6.yaml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file 
Warning: /home/austin/.ghcup/cache/ghcup-0.0.6.yaml.tmp: Permission denied
  0  134k    0   858    0     0   8429      0  0:00:16 --:--:--  0:00:16  8495
curl: (23) Failure writing output to destination
[ Warn  ] Could not get download info, trying cached version (this may not be recent!)
[ ...   ] If this problem persists, consider switching downloader via: 
[ ...   ]     ghcup config set downloader Wget
[ Error ] JSON decoding failed with: YAML exception:
[ ...   ] Yaml file not found: /home/austin/.ghcup/cache/ghcup-0.0.6.yaml
[ ...   ] Consider removing /home/austin/.ghcup/cache/ghcup-0.0.6.yaml manually.
[ ...   ] 
"_eghcup upgrade" failed!
Run Code Online (Sandbox Code Playgroud)

希望能解释一下发生了什么以及如何解决它,以便我可以开始学习 Haskell!提前致谢。

Aus*_*n T 7

解决了:

事实证明,snapcurl 的版本是半损坏的。ghcup运行后我安装成功:

sudo snap remove curl

sudo apt install curl
Run Code Online (Sandbox Code Playgroud)