无法通过$ PATH在Mac问题上安装Node.JS

时间:2018-01-15 09:12:43

标签: ruby-on-rails node.js heroku path

我试图推送到Heroku,但该应用被拒绝Webpacker requires Node.js >= 6.0.0 and you are using 0.10.30。我刚刚完成了一个node.js的全新安装,它应该在我的路径/usr/local/bin上。

我的路径在下面,对我来说看起来有点疯狂,但我可以看到/ usr / local / bin在那里。我哪里错了?

Simons-MBP:~ Simon$ echo $PATH
/Library/Frameworks/Python.framework/Versions/3.6/bin:/Users/Simon/.rvm/gems/ruby-2.4.0/bin:/Users/Simon/.rvm/gems/ruby-2.4.0@global/bin:/Users/Simon/.rvm/rubies/ruby-2.4.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/Simon/.rvm/bin

现在通过Homebrew安装了节点:

Simons-MBP:gourmet_coffee Simon$ brew link node
Linking /usr/local/Cellar/node/9.4.0... 7 symlinks created
Simons-MBP:gourmet_coffee Simon$ node --version
v9.4.0

Simons-MBP:~ Simon$ node --version
v9.4.0
Simons-MBP:~ Simon$ sudo chown -R $USER /usr/local
Password:
Simons-MBP:~ Simon$ brew link --overwrite node
Warning: Already linked: /usr/local/Cellar/node/9.4.0
To relink: brew unlink node && brew link node
Simons-MBP:~ Simon$ brew unlink node && brew link node
Unlinking /usr/local/Cellar/node/9.4.0... 7 symlinks removed
Linking /usr/local/Cellar/node/9.4.0... 7 symlinks created

然而,在推送到Heroku时,我仍然得到同样的拒绝

我应该将/usr/local/Cellar添加到我的$ PATH吗?

1 个答案:

答案 0 :(得分:0)

尝试从brew安装:

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

之后将brew区域添加到.bash_profile中的$ PATH:

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

搜索并重新安装特定版本(如果brew无法搜索节点,只需运行brew install node):

$ brew search node
$ brew unlink node
$ brew install node@6
$ brew link node@6

要查看当前节点版本:

$ node --version