1

I'm a front end dev trying to learn and get into Node.js

Having trouble at the first hurdle. I have an app.js file in the root of Mac: "/" app.js has the following:

console.log('hello world!');

Whenever I run node app.js in the terminal I get the following:

> node app.js
...

1 Answer 1

1

It looks like you're running the Node.js REPL first. Don't do that... the Node.js REPL is for running immediate evaluations.

Just try running node app.js from your normal system terminal.

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

2 Comments

That worked! However, it still won't run the http server as per the getting started example on the node site. var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(1337, '127.0.0.1'); console.log('Server running at http://127.0.0.1:1337/');
@samjhiggins Post a new question for that and explain what is/isn't happening. Maybe you have something else listening on that port already.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.