Search code examples
node.jsmacosbashterminal

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

  • I found the cause of the problem.

    I had edited the .bash_profile to add the path to JAVA but I did not end it with a colon (:) so it ended up combining the path to JAVA with /usr/local/bin

    Once I added the colon, everything started working