Mac - bash: node: command not found

I am having problems launching node.js from terminal.

I ran 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 am trying to find a solution but all the suggestions I have found do not help

In the / usr / local / bin folder, I have node and npm, but even when I go 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 file by adding / usr / local / bin, but that didn't solve the problem either

Any suggestions would be greatly appreciated! TIA!

+3


source to share


3 answers


Try to install node with homebrew - brew install npm

should do that



+1


source


If you've already installed node and still doesn't work, try running brew link node

. You can create a force link if an error occurs while creating the link.brew link --overwrite node



+1


source


I found the cause of the problem.

I edited the .bash_profile file to add the JAVA path, but I didn't end it with a colon (:), so it ended up concatenating the JAVA path with / usr / local / bin

As soon as I added the colon everything started working

0


source







All Articles