azat-co / expressworks

Learn Express.js from the author of one of the best books on Express.js—Pro Express.js— with this workshop that will teach you basics of Express.js.
MIT License
715 stars 220 forks source link

ExpressWorks Hello, World #96

Closed bessieatrazoyo closed 8 years ago

bessieatrazoyo commented 8 years ago

Wow. This is pathetic. I can’t get past the first exercise. Can anybody tell me what I’m doing wrong?

Some info. I am working on a Mac. Below are the commands that I type in the terminal and info on the output. After that is my code.

$ sudo npm install express --save [entered password, much output, nothing in red...I think it went okay] $ killall node No matching processes belonging to you were found $ expressworks run Express.js 35557 Cannot GET /home

Here’s my code Express.js:

var express = require('express');
var app = express();
console.log(process.argv[2]);
app.get('/', function(req, res) {
        res.end('Hello World!');
})
app.listen(process.argv[2]);
TylerMoeller commented 8 years ago

Try changing your fourth line to get the /home directory:

app.get('/home', function(req, res) {

If you're still having troubles, make sure you install expressworks as follows:

cd to your working directory (e.g. ~/nodeschool/expressworks) $ sudo npm install express $ sudo npm install -g expressworks

bessieatrazoyo commented 8 years ago

Changing from '/' to '/home' did the trick. Thanks, TylerMoeller!

azat-co commented 8 years ago

@TylerMoeller , thank you

TORRESDESIGN commented 5 years ago

I had to do the same, but I'm on Windows 10.