Reputation: 10748
$: which node
$: node
-bash: node: command not found
$: brew install node
Error: node-0.6.18 already installed
$: brew doctor
Error: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built.
node
$: brew link node
Error: No such file or directory - /usr/local/Cellar/node/0.6.5
$: brew uninstall node
Error: No such file or directory - /usr/local/Cellar/node/0.6.5
$: brew install node
Error: node-0.6.18 already installed
How do I get my node back on track??
Upvotes: 24
Views: 56803
Reputation:
I had the same problem with ruby. I wanted to uninstall it. Here is the fix that worked for me
brew install ruby
Then
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc
Then When I tried uninstall it worked.
brew uninstall ruby
So you can do the same by replacing ruby with node. Then install it again and it will be fixed.
Upvotes: 0
Reputation: 1
I puzzled over this for a long time. Nothing worked. I'm using macOS.
In a terminal, execute the following command to get nvm setup with appropriate node.js settings (for further details on what the script does read this https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh):
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | zsh
Restart your terminal and run the following:
nvm -v You should see a version.
Now let's install node:
nvm install 14.15 When the installation is finished, run:
node -v
You should be good to go.
Upvotes: 0
Reputation: 1
echo 'export PATH="/usr/local/opt/node@12/bin:$PATH"' >> ~/.zshrc
Upvotes: 0
Reputation: 585
I personally had to work some sudo chmod magic for node files that were not writable. Brew didn't take care of them by default even after --force was enabled.
Upvotes: 0
Reputation: 428
I was getting:
$ brew link node
Error: No such keg: /usr/local/Cellar/node
$ brew link node@8
Warning: node@8 is keg-only and must be linked with --force
That command helped to get everything working again:
brew link --overwrite --force node@8
Upvotes: 8
Reputation: 1
To force the link and overwrite all conflicting files:
brew link --overwrite node
Upvotes: 0
Reputation: 10748
I was able to relink the correct version of node by running:
brew cleanup
brew link node
brew uninstall node
brew install node
Upvotes: 55