Warning formula.jws.json update failed, falling back to cached version

Warning: formula.jws.json: update failed, falling back to cached version.

MacOS 执行服务启动命令时,显示下载失败警告,导致无法启动服务

MacBook-Pro ~ % brew services start nginx
==> Downloading https://formulae.brew.sh/api/formula.jws.json
########                                                                                                                                                                                              4.5%curl: (28) Operation too slow. Less than 100 bytes/sec transferred the last 5 seconds

Warning: formula.jws.json: update failed, falling back to cached version.
==> Downloading https://formulae.brew.sh/api/formula.jws.json
##                                                                                                                                                                                                    1.4%curl: (28) Operation too slow. Less than 100 bytes/sec transferred the last 5 seconds

Warning: formula.jws.json: update failed, falling back to cached version.
==> Downloading https://formulae.brew.sh/api/formula.jws.json
#############                                                                                                                                                                                         6.7%curl: (28) Operation too slow. Less than 100 bytes/sec transferred the last 5 seconds

Warning: formula.jws.json: update failed, falling back to cached version.
==> Downloading https://formulae.brew.sh/api/formula.jws.json
curl: (28) Operation too slow. Less than 100 bytes/sec transferred the last 5 seconds                                                                                                   #      #    #  #

Error: Failure while executing; `/usr/bin/env /usr/local/Homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --user-agent Homebrew/4.1.21\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 14.5\)\ curl/8.6.0 --header Accept-Language:\ en --fail --progress-bar --remote-time --output /Users/advoster/Library/Caches/Homebrew/api/formula.jws.json --location --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.1.21\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 14.5\)\ curl/8.6.0 --header Accept-Language:\ en --fail --progress-bar --compressed --speed-limit 100 --speed-time 5 https://formulae.brew.sh/api/formula.jws.json` exited with 28. Here's the output:
curl: (28) Operation too slow. Less than 100 bytes/sec transferred the last 5 seconds

解决方案

修改 HOMEBREW_API_DOMAIN

export HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api"
# 或
export HOMEBREW_API_DOMAIN="https://mirrors.aliyun.com/homebrew/homebrew-bottles/api"

如该命令只在终端窗口执行,那么这个命令只会对当前终端窗口有效,想要永久保存这个参数的话,请将该命令添加到名为 .zshrc 的配置文件中去。

想要新的配置立即生效,执行如下命令:

source ~/.zshrc
  • 重新执行服务启动命令结果:

    MacBook-Pro ~ % brew services start nginx
    ==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/api/formula.jws.json
    ################################################################################################################################################################################################### 100.0%
    Service `nginx` already started, use `brew services restart nginx` to restart.
    
posted @ 2024-07-24 10:55  飞仔FeiZai  阅读(131)  评论(0编辑  收藏  举报