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.
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.
You can likely run node as " /usr/local/bin/node ".
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With