Installing node with homebrew problems mac OS

2020-03-31 08:20发布

问题:

after installing homebrew,

after running brew install node

I test with:

node --version

I get:

command not found

If I rerun the install command: I get:

MacBook-Pro:~ evanloiterman$ brew install node Warning: node 10.9.0 is already installed, it's just not linked You can use brew link node to link this version. MacBook-Pro:~ evanloiterman$ brew link node Linking /usr/local/Cellar/node/10.9.0... Error: Could not symlink include/node/common.gypi Target /usr/local/include/node/common.gypi already exists. You may want to remove it: rm '/usr/local/include/node/common.gypi'

I try brew link node

I get:

Error: Could not symlink include/node/common.gypi Target /usr/local/include/node/common.gypi already exists. You may want to remove it: rm '/usr/local/include/node/common.gypi'

To force the link and overwrite all conflicting files: brew link --overwrite node

To list all files that would be deleted: brew link --overwrite --dry-run node

What should I try next to ensure this is working?

回答1:

You should install NVM (Node Version Manager). With this tool you can choose which node to use and install.

https://nodesource.com/blog/installing-node-js-tutorial-using-nvm-on-mac-os-x-and-ubuntu/



回答2:

If you want to run Homebrew UNINSTALL node and begin clean.

To fix this problem I found the answer on this site:

uninstall homebrew on a mac

I ran the ruby script and then decided to just start clean again and forget about homebrew for now.