2

I have just installed node.js on my ubuntu laptop.

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

Installed with no errors, but when I ran the server.js sample application program nothing happened.

Worse still, I tried to run a ver basic hello world script called hello.js

console.log("hello world");

When I type : 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?

thanks

EDIT

just noticed in terminal if I type:

node console.log("hello world");

I get

$ node console.log("hi");

bash: syntax error near unexpected token `('

5
  • what happens when you call localhost:1337 in your browser? Commented Mar 5, 2013 at 22:10
  • Chromium's connection attempt to localhost was rejected. The website may be down, or your network may not be properly configured. 127.0.0.1 works fine, ALso, I just noticed on command line I cant even call node -v . Just exits as before Commented Mar 5, 2013 at 22:14
  • 1
    What do you get from which -a node? You might have another node executable already in PATH and are running that instead of Node.js. Commented Mar 5, 2013 at 22:18
  • I get two lines of output: /usr/local/bin/node :: and : /usr/sbin/node Commented Mar 5, 2013 at 22:20
  • 3
    Try nodejs yourscript.js there is a filename change and node itself may refer to something else Commented Mar 5, 2013 at 23:08

1 Answer 1

5

Either run your file like

node <your_file>.js

or add this on top #!/usr/bin/env node

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.