Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node.js express module not loading properly

Geos-Mac:hone georgiana$ npm list
/Users/georgiana/local/hone
├─┬ [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ └── [email protected] 
├── [email protected] 
└── [email protected]

However, a simple script that contains

var express = require( 'express' ).createServer();

gives

Error: Cannot find module 'express'
at Function._resolveFilename (module.js:322:11)
.........

when trying to use express.

Please note that

Geos-Mac:hone georgiana$ npm express -v
1.0.6

and

Geos-Mac:hone georgiana$ node -v
v0.5.0-pre

Any ideas?

like image 519
Georgiana Avatar asked Dec 22 '22 13:12

Georgiana


1 Answers

solved by installing the express module inside the application's folder; inspired by the manual http://nodejs.org/docs/v0.4.1/api/modules.html#loading_from_node_modules_Folders

so, inside /Users/georgiana/Sites/nodejs-play I executed the npm install express command, which installed the module in /Users/georgiana/Sites/nodejs-play/node_modules/express

like image 125
Georgiana Avatar answered Dec 26 '22 00:12

Georgiana