Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node: command not found [duplicate]

Tags:

node.js

I am in the process of setting up node.js in order to work with a framework like Meteor, Derby, or Ember, but am running into some problems early on. Following these instructions (http://www.nodebeginner.org), I installed node, created a simple helloworld.js file, then ran this command in the terminal:

node path/to/file/helloworld.js 

but I get the following error:

-bash: node: command not found 

I've tried navigating to the directory, then simply running:

node helloworld.js 

but get the same error. I am completely new to node.js and am at a loss.

Running OS X 10.7.5 and the latest version of node.

like image 720
Alex Getty Avatar asked Nov 27 '12 21:11

Alex Getty


People also ask

Why is node command not found?

Windows Manually Add Node and NPM to Path On Windows, you may face the “npm command not found” error if the path to nodejs and npm are not added to your path variable. To fix this, locate the path to nodejs and npm binaries. The command above should add the specified directory to the path variable.

Where is node command located?

You can likely run node as " /usr/local/bin/node ".

Can't find node JS command prompt?

Make sure the node path is added, if not added it. After doing this restart Visual Studio or open a fresh command prompt. From the command prompt type 'node -v' to echo the node version installed. You can also add the path to node or any other application directly on the command line.

What does node command do?

Node allows developers to write JavaScript code that runs directly in a computer process itself instead of in a browser. Node can, therefore, be used to write server-side applications with access to the operating system, file system, and everything else required to build fully-functional applications.


1 Answers

The problem is that your PATH does not include the location of the node executable.

You can likely run node as "/usr/local/bin/node".

You can add that location to your path by running the following command to add a single line to your bashrc file:

echo 'export PATH=$PATH:/usr/local/bin' >> $HOME/.bashrc source $HOME/.bashrc 
like image 115
maerics Avatar answered Oct 01 '22 19:10

maerics