I have just installed node.js on my ubuntu laptop.
我刚刚安装了node。在我的ubuntu笔记本电脑上。
I followed the instructions found here: http://davidtsadler.com/archives/2012/05/06/installing-node-js-on-ubuntu/#application and installed from the git repository
我遵循了这里找到的说明:http://davidtsadler.com/archives/2012/05/06/installing-node-js-on-ubuntu/#应用程序,并从git存储库中安装
Installed with no errors, but when I ran the server.js sample application program nothing happened.
安装时没有错误,但当我运行服务器时。js示例应用程序什么也没发生。
Worse still, I tried to run a ver basic hello world script called hello.js
更糟糕的是,我尝试运行一个名为hello.js的基本hello world脚本
console.log("hello world");
When I type : node hello.js
当我输入:node hello.js。
nothing happens, there is no error message, nothing is written to the console window.
没有发生任何事情,没有错误消息,没有写入控制台窗口。
IS there any known issues with node on ubuntu?
ubuntu上的node有什么已知的问题吗?
thanks
谢谢
EDIT
编辑
just noticed in terminal if I type:
刚刚注意到如果我输入:
node console.log("hello world");
I get
我得到
$ node console.log("hi");
节点console.log美元(“嗨”);
bash: syntax error near unexpected token `('
bash:语法错误接近意外的标记' ('
1 个解决方案
#1
4
Either run your file like
要么运行您的文件,比如。
node <your_file>.js
节点< your_file > . js
or add this on top #!/usr/bin/env node
或者把这个添加到#!/usr/bin/env节点
#1
4
Either run your file like
要么运行您的文件,比如。
node <your_file>.js
节点< your_file > . js
or add this on top #!/usr/bin/env node
或者把这个添加到#!/usr/bin/env节点