Reputation: 5458
Server is Ubuntu 12.0.4 x64, Node.js version is v0.8.9 (built from source code). I have succesfully installed express
by sudo npm install -g express
then tried below sample code to verify express
but get error saying "Can not find module 'express'"
var express = require('express');
Upvotes: 0
Views: 1043
Reputation: 165971
You've installed the module globally. To use it in your project you need to install it locally. From your project directory:
npm install express
Or, add it to the dependencies in your package.json file and just run npm install
. This will create a node_modules directory in your project, into which all local modules will be installed.
Upvotes: 2