Mac安装node

Posted 年少~年

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mac安装node相关的知识,希望对你有一定的参考价值。

执行:brew install node
报错

➜   brew install node
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libuv-1.42.0.monterey.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/libuv/manifests/1.42.0
Already downloaded: /Users/runzhliu/Library/Caches/Homebrew/downloads/4ce1023eed1fe46fcf9d27bb80ca32edb847285d1976eb5663e78eebf13c5982--libuv-1.42.0.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/libuv/blobs/sha256:9065ec0fbc415fa235ed422edb22fd45b28d5a3207ce9e1b0565903f2ce33fd4
Already downloaded: /Users/runzhliu/Library/Caches/Homebrew/downloads/3bf90de0784d8836130616c725afabfcea9c770bd877c65c44dad32a09d9a8ae--libuv--1.42.0.monterey.bottle.tar.gz
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/openssl%401.1-1.1.1m.monterey.bottle.tar.gz
Already downloaded: /Users/runzhliu/Library/Caches/Homebrew/downloads/aeaeddbc066154a6a2c95c81e016b45e24802199c03562d19cd5ea2f4563651a--openssl@1.1-1.1.1m.monterey.bottle.tar.gz
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/node-17.3.0.monterey.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/node/manifests/17.3.0
Already downloaded: /Users/runzhliu/Library/Caches/Homebrew/downloads/62db815e59375a25f6a69241c76599c42de672de4feac8071b4131cbc60bc444--node-17.3.0.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/node/blobs/sha256:d2ca921aa8849d4492d5de83bcd47b3db062a17e73b25d9cc4fe6649f59b51cb
Already downloaded: /Users/runzhliu/Library/Caches/Homebrew/downloads/963a04111f17107835e51b203e1a65049873201b2455c19576985353ef6dda37--node--17.3.0.monterey.bottle.tar.gz
==> Installing dependencies for node: libuv and openssl@1.1
==> Installing node dependency: libuv
==> Pouring libuv-1.42.0.monterey.bottle.tar.gz
Error: No such file or directory @ rb_sysopen - /Users/runzhliu/Library/Caches/Homebrew/downloads/e874c93159bf4856f79b7934a9a25556c21423f7241632362bb9a62160b6b476--libuv-1.42.0.monterey.bottle.tar.gz

先执行 brew install libuv,再执行 brew install node。

如果提示这个错误:Node already installed, it’s just not linked
执行下面的步骤

第一步:sudo chown -R $(whoami) $(brew --prefix)/*
第二步:brew link --overwrite node

如果不行,就执行这步:
brew reinstall node

当node安装成功,对应的npm也安装成功了

以上是关于Mac安装node的主要内容,如果未能解决你的问题,请参考以下文章

Mac下更新node版本和用yarn安装依赖

Mac安装Nvm Node开发环境

mac 下关于node版本的切换

mac系统安装node

mac安装node

Mac 安装 nvm 教程