You need to enable JavaScript to run this app. 运行makepkg -sic编译AUR的yay时出现Go模块拉取超时错误
优惠活动
大模型
产品
解决方案
定价
更多

运行makepkg -sic编译AUR的yay时出现Go模块拉取超时错误

操作与报错描述

我通过git clone https://aur.archlinux.org/yay.git命令克隆yay的AUR仓库,进入项目目录后执行makepkg -sic命令进行编译安装,出现如下报错:

==> Making package: yay 10.1.0-1 (Mon 26 Oct 2020 06:25:36 AM +0330)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Downloading yay-10.1.0.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   118  100   118    0     0     97      0  0:00:01  0:00:01 --:--:--    97
100  339k  100  339k    0     0   103k      0  0:00:03  0:00:03 --:--:--  168k
==> Validating source files with sha256sums...
    yay-10.1.0.tar.gz ... Passed
==> Extracting sources...
  -> Extracting yay-10.1.0.tar.gz with bsdtar
==> Starting build()...
go build -v -trimpath -mod=readonly -modcacherw -ldflags '-s -w -extldflags "-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" -X "main.yayVersion=10.1.0" -X "main.localePath=/usr/share/locale/"' -buildmode=pie -o yay
go: github.com/Jguer/go-alpm/v2@v2.0.1: Get "https://gocenter.io/github.com/%21jguer/go-alpm/v2/@v/v2.0.1.mod": dial tcp 35.230.74.213:443: i/o timeout
make: *** [Makefile:127: yay] Error 1
==> ERROR: A failure occurred in build().
    Aborting...
故障原因

源码下载、校验、解压环节全部校验通过,在Go编译阶段拉取go-alpm依赖时超时。系统默认Go模块代理指向已停止对外服务的gocenter.io节点,该节点在多数网络环境下无法正常连通,直接导致依赖拉取失败、构建流程中断。

解决步骤
  • 进入此前克隆的yay AUR源码目录
  • 执行命令临时切换Go模块代理为可正常访问的公共镜像:
    export GOPROXY=https://goproxy.cn,direct
  • 重新执行编译安装命令:
    makepkg -sic

若需长期生效上述代理配置,可将上述export命令追加写入shell配置文件(如~/.bashrc、~/.zshrc),后续所有Go项目编译无需重复配置。

内容的提问来源于stack exchange,提问作者nino

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.11.20 03:54:02