在终端输入 brew install node 回车 报错如下图
brew install node
==> Installing dependencies for node: icu4c
==> Installing node dependency: icu4c
==> Downloading https://homebrew.bintray.com/bottles/icu4c-62.1.mojave.bottle.ta
Already downloaded:
/Users/lvhongjian/Library/Caches/Homebrew/downloads/2ac513734226effaf79e199fb1612ebce7842df443578bcd61afd73767858aef–icu4c-62.1.mojave.bottle.tar.gz
Error: No such file or directory @ dir_chdir - /usr/local/Cellar
Warning: Bottle installation failed: building from source.
==> Downloading https://ssl.icu-project.org/files/icu4c/62.1/icu4c-62_1-src.tgz
Already downloaded:
/Users/lvhongjian/Library/Caches/Homebrew/downloads/b79f5dd51110fb1096e57fc35ba03df84f69142b0374bae8a0381edde5a80448–icu4c-62_1-src.tgz
Error: An exception occurred within a child process: Errno::EPERM:
Operation not permitted @ dir_s_mkdir - /usr/local/Cellar
解决办法
由于登陆用户不是HomeBrew的安装用户、所以报以上错误这里解决如下:
1.在当前用户重新安装HomeBrew /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2.运行brew install node提示成功