2

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

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

安装没有错误,但是当我运行 server.js 示例应用程序时,什么也没发生。

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

console.log("hello world");

当我输入: node hello.js

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

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

谢谢

编辑

如果我输入,就会在终端中注意到:

node console.log("hello world");

我明白了

$ 节点控制台.log("hi");

bash:意外标记'('附近的语法错误

4

1 回答 1

5

要么像这样运行你的文件

node <your_file>.js

或将其添加到顶部 #!/usr/bin/env node

于 2017-01-21T01:12:43.773 回答