下面是通过 brew install node 执行,但是报错了。
suwei@suweideMacBook-Pro ~ % brew install node@14
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/c-ares-1.18.1.arm64_big_sur.bottle.tar.gz
##O#- #
curl: (22) The requested URL returned error: 404
Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/c-ares/manifests/1.18.1
Already downloaded: /Users/suwei/Library/Caches/Homebrew/downloads/4f6b317a7f5bfbda604a7c7d02a110dfcf3e2d2dbbe1a339685bf56e4d313ff2--c-ares-1.18.1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/c-ares/blobs/sha256:555cf945221fc8f076919a16e07541a37841bfc63ed2c58e24311f93ac2f2af6
Already downloaded: /Users/suwei/Library/Caches/Homebrew/downloads/3e3cbfe7ddd2b080baf2fd6756e86c437f09486269aa33646afbc22484a691bb--c-ares--1.18.1.arm64_big_sur.bottle.tar.gz
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/icu4c-69.1.arm64_big_sur.bottle.tar.gz
#=#=#
curl: (22) The requested URL returned error: 404
Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/icu4c/manifests/69.1
Already downloaded: /Users/suwei/Library/Caches/Homebrew/downloads/319330d53dab436f7e6bbe478539f29d41abb6be79788b06615f28006a82b30c--icu4c-69.1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/icu4c/blobs/sha256:25a1ec460d422ba5abff15dc5cb60ad36003ad021585fa7be278d1dca6fcd2c4
Already downloaded: /Users/suwei/Library/Caches/Homebrew/downloads/ccf6b67f22944e4ef3d02f6108f71d827eb5193bfeb2a23b10a3471f43e79874--icu4c--69.1.arm64_big_sur.bottle.tar.gz
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libnghttp2-1.46.0.arm64_big_sur.bottle.tar.gz
##O#- #
curl: (22) The requested URL returned error: 404
Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/libnghttp2/manifests/1.46.0
Already downloaded: /Users/suwei/Library/Caches/Homebrew/downloads/d55a2f1fb62a2e27c224645798155f3226ca864134acd4e39dd7ddf4b8f79c50--libnghttp2-1.46.0.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/libnghttp2/blobs/sha256:f73eb0a7cec33617af3678052a930246107b6fa0d00fc480678718227fe661a4
Already downloaded: /Users/suwei/Library/Caches/Homebrew/downloads/df7bc8aa9757c607c01638d46172bf78baaefae6d3e134e983aac2006844390a--libnghttp2--1.46.0.arm64_big_sur.bottle.tar.gz
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libuv-1.42.0.arm64_big_sur.bottle.tar.gz
##O#- #
curl: (22) The requested URL returned error: 404
Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/libuv/manifests/1.42.0
Already downloaded: /Users/suwei/Library/Caches/Homebrew/downloads/4ce1023eed1fe46fcf9d27bb80ca32edb847285d1976eb5663e78eebf13c5982--libuv-1.42.0.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/libuv/blobs/sha256:68f6757ac44fdd21a8c3d697ca201b2063dfa2e995c783637189a4467d87f71b
Already downloaded: /Users/suwei/Library/Caches/Homebrew/downloads/f9240ce9f228a388d57b3537248c93de502af40cf86adfc544fc1fdfccc87b58--libuv--1.42.0.arm64_big_sur.bottle.tar.gz
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/macos-term-size-1.0.0.arm64_big_sur.bottle.tar.gz
Already downloaded: /Users/suwei/Library/Caches/Homebrew/downloads/6d9654166da2f134852fcaccab7fee6c9cbac5a9de7c3dfa299493c2d3b0d84a--macos-term-size-1.0.0.arm64_big_sur.bottle.tar.gz
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/node%4014-14.18.1.arm64_big_sur.bottle.tar.gz
##O#- #
curl: (22) The requested URL returned error: 404
Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/node/14/manifests/14.18.1
Already downloaded: /Users/suwei/Library/Caches/Homebrew/downloads/9fa936cbe39368bce41fabbc8d50a2e2e04a17a7e8d64a0218b07052b57969fd--node@14-14.18.1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/node/14/blobs/sha256:2e486bafc76ab44770a6b61f21f934939a76dd7a15dac775025b3c5a7c271baa
Already downloaded: /Users/suwei/Library/Caches/Homebrew/downloads/4eff343b4861a9c38fa27ba759c1819ef7534d1dbe279f8e217a06c228f92755--node@14--14.18.1.arm64_big_sur.bottle.tar.gz
==> Installing dependencies for node@14: c-ares, icu4c, libnghttp2, libuv and macos-term-size
==> Installing node@14 dependency: c-ares
==> Pouring c-ares-1.18.1.arm64_big_sur.bottle.tar.gz
Error: No such file or directory @ rb_sysopen - /Users/suwei/Library/Caches/Homebrew/downloads/aaceeec0b1184157ff8b0ff3c53d655d0685ea37ba254ebbcb9e2d97dddea377--c-ares-1.18.1.arm64_big_sur.bottle.tar.gz
很多同学这里就会卡住,所以还是要仔细看看报错的日志,这里说 c-ares 找不到,那换个思路,先 brew install c-ares,发现成功了。
虽然没仔细看过 brew 的代码,但是根据这两处日志,判断我采用的 brew 的源中没有 aaceeec0b1184157ff8b0ff3c53d655d0685ea37ba254ebbcb9e2d97dddea377--c-ares-1.18.1.arm64_big_sur.bottle.tar.gz 这个包,但是有 node 的包,而在下载的过程中,一般来说遇到 domain,也就是源不存在的包,可能会降级到默认的 domain,可能是国外的源,但是这里安装 node 的时候已经选定了我设置的源,所以找 c-ares 的时候没找到,但是没有直接给降级到默认的 domain,所以这里存在我直接 brew install c-ares 成功,但是通过 brew install node 来安装 libuv 失败了。
最后 libuv 安装成功后,重新执行一下 brew install node 问题就解决了。