fat/space-tweet

Getting the following-Error: Cannot find module 'express'

Closed this issue · 4 comments

After installing Node and NPM, I'm getting the following error when I attempt to deploy...

macbook:space-tweet user$ sudo node server.js

node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'express'
at Function._resolveFilename (module.js:317:11)
at Function._load (module.js:262:25)
at require (module.js:346:19)
at Object. (/Users/user/Desktop/space-tweet/server.js:9:15)
at Module._compile (module.js:402:26)
at Object..js (module.js:408:10)
at Module.load (module.js:334:31)
at Function._load (module.js:293:12)
at Array. (module.js:421:10)
at EventEmitter._tickCallback (node.js:126:26)

fat commented

you have to run npm install from the root of the dir to install local dependencies first

I think that did it. Thanks for your help.

fat commented

no problem! :)

If you on windows use:

export NODE_PATH="C:\Users\IMarek\AppData\Roaming\npm\node_modules"

I explained in bit more details on my post Error can not find module but bottom line it can be fixed (on Windows) by: