Error: Cannot find module 'connect'

Express internally uses Connect as one of its node_modules dependencies.

If you wish to use Connect in your app, you'll need to add it to your package.json and run npm update.

By design, each node module has its own private internal dependencies.

If you want to use any, your app will need to install them too.

It means your app can use a different version of the modules, and each module can internally use different versions again without conflicts.


The connect module either is not installed or installed partially so install it firstly and later on try to start the server again

  npm install connect

Connect is an extensible HTTP server framework that Express uses. In particular Express uses it provide support for sessions and cookie handling. The source code is available on github at https://github.com/senchalabs/connect.

Generally when a node application 'can't find' something the first thing to try is to go to https://npmjs.org/package/npm-search and search for what can't be found. It would be hard to get along in the node eco-system without using npm.

In this case npmsearch will find connect and if you go to https://npmjs.org/package/connect you'll find the installation instructions for the connect module.

In this case :

npm install connect

npm -g install connect 

installs the connect module for every user.

You may need to be root or use sudo to do this on most unix distributions.

Alternatively you can add the connect dependency to your project's package.json file - mine looks like this:

"express": "3.x" ,
"connect": "2.x"

I also had to use npm to install the modules buffer-crc32, methods, debug, fresh, range-parser, cookie-signature and cookie to get a working express project.

Happy node hacking :)