使用brew 命令安裝Node時(shí)提示-bash: brew: command not found

參照官網(wǎng)上很簡單的一句安裝命令,

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安裝完畢后,發(fā)現(xiàn)使用brew命令,卻總是提示:-bash: brew: command not found


解決方式。其實(shí)解決這個(gè)問題真的很簡單。如下:

sudo vim .bash_profile,打開后接在后面添加,注意:不要換行

export PATH=/usr/local/bin:$PATH

保存,source .bash_profile使配置修改生效。

再次使用brew 命令就ok了。

在使用命令brew install node 安裝node時(shí)遇到以下錯(cuò)誤

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin16/rbconfig.rb:213: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777

Updating Homebrew...

Error: You must `brew link pkg-config` before node can be installed

而是按照提示 輸入brew link pkg-config 接著報(bào)錯(cuò)

Error: Could not symlink bin/pkg-config

Target /usr/local/bin/pkg-config

is a symlink belonging to pkg-config. You can unlink it:

brew unlink pkg-config

To force the link and overwrite all conflicting files:

brew link --overwrite pkg-config

To list all files that would be deleted:

brew link --overwrite --dry-run pkg-config

按照上面提示的依次輸入brew unlink pkg-config;brew link --overwrite pkg-config;brew link --overwrite --dry-run pkg-config;(每個(gè)分號單獨(dú)一條命令)問題解決

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容