'Mac -bash: node: command not found
I am having problems running node.js from the terminal.
I have run the node.js installer for mac, but when I try to use the node command in the terminal, I get the following error:
-bash: node: command not found
I have been trying to look for a solution but all the suggestions I found, dont help
In the folder /usr/local/bin I have node and npm, but even when I navigate to the folder and run node, I still get the same error. I don't understand why this is happening, because I can see that node exists in the folder.
I also tried to edit the .bash_profile by adding /usr/local/bin but that didn't resolve the issue either
Any suggestions would be greatly appreciated! TIA!
Solution 1:[1]
brew search node
then brew install node@version, example:
brew install node@8
brew link node@8
node --version
Still getting node not found, try this:
brew link --overwrite --force node@8
Solution 2:[2]
Try installing node with homebrew - brew install npm should do it
Solution 3:[3]
If you have already installed node and still doesn't work, you might try running brew link node. You could create a force link if an error occurs while creating the link. brew link --overwrite node
Solution 4:[4]
Simply run this command in your terminal:
export PATH=$PATH:/usr/local/bin
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nick Roz |
| Solution 2 | Naseer |
| Solution 3 | Shamal Perera |
| Solution 4 | Andronicus |
