使用brew 命令安装Node时提示-bash: brew: command not found

参照官网上很简单的一句安装命令,

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

安装完毕后,发现使用brew命令,却总是提示:-bash: brew: command not found


解决方式。其实解决这个问题真的很简单。如下:

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

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

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

再次使用brew 命令就ok了。

在使用命令brew install node 安装node时遇到以下错误

/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 接着报错

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;(每个分号单独一条命令)问题解决

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容