Reputation: 4170
I'm messing around with Node.js for the first time and decided to create a simple application using express. I followed the instructions from github in an empty directory like so:
npm install -g express
express
npm install -d
node app.js
When navigating to localhost:3000
I get the follow error:
Express
500 Error: Cannot find module './lib/jade'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object. (C:\dev\gravity_kata\node_modules\jade\index.js:4:5)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
When looking under node_modules\jade\lib
I see all of Jade's library files, but no jade
folder. So I created a folder under lib called jade and moved the library files there and now my default application works.
Now, seeing as I have nearly no experience with Node.js and Express I'm pretty sure I did something wrong. Does anybody have any idea what is going on here?
Edit:
I dove into the Jade code. Under Jade's index.js file it requires lib\jade
and looking under the lib folder, there was no jade.js
file. Well, that is the problem, but why is the jade.js file missing? When pulling the Jade source from npm, there is a jade.js file under the lib directory. I copied the lib folder from the downloaded source into the Jade module for my project and it works fine now.
So for some reason, npm isn't pulling down the jade.js file. The version in the packages.json
file match the source i pulled down, 0.21.0
. Anybody have an idea on why this happened?
Upvotes: 5
Views: 5896
Reputation: 67
I just found this problem with the error of jade module. Looks like the jade folder was doesn't created automaticly (some kind of bug). Now i resolved this with reinstall jade. After that the jade folder was automaticly created. use npm uninstall gulp-jade and then install gulp-jade again
Upvotes: 0
Reputation: 1957
Really make sure that all the module require
s are correct. Javascript is very funny about telling you what is actually wrong. Try removing the jade template line and see what happens then.
Upvotes: 0
Reputation: 348
cd to your express project folder and run "npm install", this will install all dependencies
Upvotes: 11
Reputation: 6825
it probably has to do with the fact, that you installed express globally (-g
), but the npm install -d
was done locally. try to install them both globally, or as i would prefer, both locally:
sudo npm uninstall express -g
npm install express
npm install jade (or npm install -d)
Upvotes: 2