Javascript – Cannot find module formidable – Node.js

javascriptmodulenode.js

I'm starting to develop with node.j,I meet an issue regarding the using of the module 'formidable'.

I have this error:

Error: Cannot find module 'formidable'

Here is the module list installed using 'npm ls installed' :

├─┬ express@2.5.9 
│ ├── connect@1.8.7 
│ ├── mime@1.2.4 
│ ├── mkdirp@0.3.0 
│ └── qs@0.4.2 
├── formidable@1.0.9 
├─┬ node-inspector@0.1.10 
│ ├── paperboy@0.0.3 
│ └─┬ socket.io@0.8.7 
│   ├── policyfile@0.0.4 
│   ├── redis@0.6.7 
│   └─┬ socket.io-client@0.8.7 
│     ├── uglify-js@1.0.6 
│     ├── websocket-client@1.0.0 
│     └── xmlhttprequest@1.2.2 
├─┬ npm@1.1.21 
│ ├── abbrev@1.0.3 
│ ├── archy@0.0.2 
│ ├── block-stream@0.0.5 
│ ├── chownr@0.0.1 
│ ├── fstream@0.1.18 
│ ├─┬ fstream-npm@0.0.6 
│ │ └── fstream-ignore@0.0.5 
│ ├── graceful-fs@1.1.8 
│ ├── inherits@1.0.0 
│ ├── ini@1.0.2 
│ ├── lru-cache@1.0.5 
│ ├── minimatch@0.2.2 
│ ├── mkdirp@0.3.0 
│ ├─┬ node-gyp@0.4.1 
│ │ ├── ansi@0.0.4 
│ │ └── glob@3.1.9 
│ ├── node-uuid@1.3.3 
│ ├── nopt@1.0.10 
│ ├── proto-list@1.0.0 
│ ├── read@0.0.2 
│ ├── request@2.9.153 
│ ├── rimraf@2.0.1 
│ ├── semver@1.0.13 
│ ├── slide@1.1.3 
│ ├── tar@0.1.13 
│ ├── uid-number@0.0.3 
│ └── which@1.0.5 
└─┬ socket.io@0.9.6 
  ├── policyfile@0.0.4 
  ├── redis@0.6.7 
  └─┬ socket.io-client@0.9.6 
    ├─┬ active-x-obfuscator@0.0.1 
    │ └── zeparser@0.0.5 
    ├── uglify-js@1.2.5 
    ├─┬ ws@0.4.14 
    │ ├── commander@0.5.2 
    │ └── options@0.0.3 
    └── xmlhttprequest@1.2.2 

I add that it is the only module who generate this error.

Also, I don't really understand the way are encapsulated some module, it appears that npm is installing the module directly in the directory I'm using the module installation command, and I notice that formidable has been installed in the express/connect/ module on its first installation.

Can you give me more information about the module installation tree.
Thank for your replies

Cheers

Best Answer

The accepted answer looks very comprehensive and correct, but this worked for me:

npm install -d

d stands for dependencies (I think)