[英]Ubuntu Sublime Text 2 Java Script compiling but not running
I'm setting up Sublime text 2 and running: 我正在设置Sublime文本2并运行:
console.log("Hello!");
But all I'm getting in the console is "finished in [0.0] 但是我在控制台中获得的所有信息都“以[0.0]完成
My build system is: 我的构建系统是:
{
"cmd": ["node", "$file"],
"selector": "source.js"
}
Any help would be greatly appreciated. 任何帮助将不胜感激。 This again is being done in Ubuntu.
这再次在Ubuntu中完成。
The nodejs
package for Ubuntu provides /usr/bin/nodejs
, not /usr/bin/node
. Ubuntu的
nodejs
软件包提供/usr/bin/nodejs
,而不提供/usr/bin/node
。 The node
package, for amateur packet radio nodes, provides /usr/sbin/node
, which is what your build system is running. 用于业余分组无线节点的
node
软件包提供了/usr/sbin/node
,这是您的构建系统正在运行的内容。 It has nothing to do with Javascript, hence no output. 它与Javascript无关,因此没有输出。 There are two options (assuming you've already installed
nodejs
), and you can do one or both: 有两个选项(假设您已经安装了
nodejs
),并且您可以执行以下一项或两项操作:
From the command line, run 从命令行运行
sudo ln -s /usr/bin/nodejs /usr/local/bin/node
This will create a symlink to node that (I think, I'm not in Ubuntu at the moment) should be before /usr/sbin
in your $PATH
. 这将创建到节点的符号链接(我想,我目前不在Ubuntu中)应该在
$PATH
/usr/sbin
之前。 Run echo $PATH
to verify the order of your path. 运行
echo $PATH
验证路径的顺序。
Change your build system to run /usr/bin/nodejs
instead of node
. 将构建系统更改为运行
/usr/bin/nodejs
而不是node
。 This will fix your immediate problem, but if you don't run the other command above you may have issues with Sublime's NodeJS
plugin. 这将解决您的直接问题,但是,如果您没有运行上面的其他命令,则Sublime的
NodeJS
插件可能会出现问题。
Good luck! 祝好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.