Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Cannot find module 'connect'

It appears that this simple app can't find the 'connect' module after I just installed it in the file directory.

var connect = require ('connect');

connect.createServer(function(res, req, next) {
    res.simpleBody("Connect you son of a beeeeetch");

}).listen(8000);



[email protected] node_modules/express
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])
Dzs-Mac-Attax-2:PlsWrk Dz$ node test.js

module.js:340
    throw err;
      ^
Error: Cannot find module 'connect'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/Users/Dz/Documents/NodeTests/PlsWrk/test.js:1:77)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)
like image 566
Architek1 Avatar asked Mar 12 '13 01:03

Architek1


1 Answers

you can use the following command, this might happen if you forget to install the connect serve-static module or installed it incorrectly.

$ npm install connect serve-static
like image 100
XORG_99 Avatar answered Oct 07 '22 00:10

XORG_99