Mac下安装node环境,这里介绍的只是其中一种
1、打开终端,输入/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"安装管理平台homebrew
/usr/bin/ruby -e "$(curl -fsSL [https://raw.githubusercontent.com/Homebrew/install/master/install](https://raw.githubusercontent.com/Homebrew/install/master/install))"
执行之后报错curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation
-
这里说明一下,有些同学针对出现此错误的解决办法是:重装command line tools,再执行安装指令,然鹅,我自己试了一下,对我没用。。。。
终端报错图片 -
解决办法
- 在浏览器输入地址https://raw.githubusercontent.com/Homebrew/install/master/install
打开如下:
打开地址图片 - 保存网页名为:brew_install.rb,保存位置随意,但要能找到
- 在终端输入$curl
-
在终端进入存放brew_install.rb(上面保存的文件)的目录,然后运行$ruby brew_install.rb
步骤
在等待安装homebrew时,出现问题LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: the remote end hung up unexpectedly
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Enumerating objects: 683250, done.
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core` exited with 128.
Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1.
Failed during: /usr/local/bin/brew update --force
- 解决办法,按步骤执行
// 执行命令,更换为中科院的镜像:
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
// 把homebrew-core的镜像地址也设为中科院的国内镜像
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
// 更新
brew update
// 使用
brew install node
最终大功告成
MacBook-Pro:homebrew-core su$ brew -v
Homebrew 2.2.6
Homebrew/homebrew-core (git revision 6bc2; last commit 2020-02-20)
MacBook-Pro:homebrew-core su$ node -v
v13.8.0
报错解决参考
1、https://www.jianshu.com/p/68efabd2e32b
2、https://www.jianshu.com/p/9118ee9da3b7
网友评论