Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Express Basics Getting Started with Express Creating a Route with Express

Anna Shalaginova
Anna Shalaginova
3,160 Points

Node app.js command not working

When I run app.js in the terminal, it does not open local host in browser window. I see no error messages in mac terminal, the command just takes me to the next line like it's expecting me to input additional information.

From app.js

app.js
const express = require('express');
const app = express();
app.get();
app.listen(3000)

From package.json

package.json
{
  "name": "flashcards",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1"
  }
}

1 Answer

Michael Hulet
Michael Hulet
47,912 Points

It sounds like you're running just the command node on its own, and potentially typing app.js into the REPL after that. Make sure you don't already have a Node REPL running, and you're in your at the usual command prompt, then paste the following line in exactly as-is:

node app.js

After you hit return, your app should be running