无法运行简单的HelloWorld node.js脚本

Kev*_*haw 2 node.js ubuntu-12.04

我刚刚在Ubuntu笔记本电脑上安装了node.js。

我按照此处找到的说明进行操作:http : //davidtsadler.com/archives/2012/05/06/installing-node-js-on-ubuntu/#application并从git存储库安装

安装时没有错误,但是当我运行server.js示例应用程序时,没有任何反应。

更糟糕的是,我尝试运行一个名为hello.js的基本的hello世界脚本

console.log("hello world");
Run Code Online (Sandbox Code Playgroud)

当我输入时:node hello.js

没有任何反应,没有错误消息,没有任何内容写入控制台窗口。

ubuntu上的节点是否存在任何已知问题?

谢谢

编辑

刚在终端中注意到,如果我键入:

node console.log("hello world");
Run Code Online (Sandbox Code Playgroud)

我懂了

$节点console.log(“ hi”);

bash:意外令牌'('附近的语法错误

小智 5

要么像运行文件

node <your_file>.js

或在顶部添加 #!/usr/bin/env node