节点:找不到命令 [英] node: command not found
问题描述
我正在设置node.js以便与Meteor,Derby或Ember之类的框架一起工作,但是在早期就遇到了一些问题.按照以下说明(http://www.nodebeginner.org),我安装了node,创建了一个简单的helloworld.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
但是出现以下错误:
-bash: node: command not found
我尝试导航到目录,然后简单地运行:
I've tried navigating to the directory, then simply running:
node helloworld.js
,但得到相同的错误.我对node.js完全陌生,一头雾水.
but get the same error. I am completely new to node.js and am at a loss.
正在运行OS X 10.7.5和最新版本的节点.
Running OS X 10.7.5 and the latest version of node.
推荐答案
问题是您的PATH不包含节点可执行文件的位置.
The problem is that your PATH does not include the location of the node executable.
您可以将节点运行为"/usr/local/bin/node
".
You can likely run node as "/usr/local/bin/node
".
您可以通过运行以下命令在您的bashrc文件中添加一行来将该位置添加到路径中:
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
这篇关于节点:找不到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!