Abhijeet Umbarkar Abhijeet Umbarkar - 4 months ago 7x
Node.js Question

Install express js with npm

I'm installed nodejs on my ubuntu 14.04 machine. When i ran node --version it gives me v4.4.2. I have install npm with version 3.9.2. When i run command npm install -g express it gives following output
install express js

After completing the process, when I try to check express version it tells that The program 'express' is not installed try apt-get install node-express. Can somebody tell me where I'm doing wrong


As I said in my comment, ExpressJS it's a framework for developing servers. It's not a server by itself.

You should create a npm project (with npm init) and you can install it as a dependency with npm install express --save. Then refer to the "Hello World" example to see how to create a simple server: Hello World Starter

var express = require('express');
var app = express();

app.get('/', function (req, res) {
  res.send('Hello World!');

app.listen(3000, function () {
  console.log('Example app listening on port 3000!');

Also, you may want to serve static files by using