node.js - how can I enable jade on my application? -


i trying follow post

my server.js this

var express = require('express');  var app = express(); var jade = require('jade'); 

and error

module.js:340     throw err;           ^ error: cannot find module 'jade'     @ function.module._resolvefilename (module.js:338:15)     @ function.module._load (module.js:280:25)     @ module.require (module.js:364:17)     @ require (module.js:380:17)     @ object.<anonymous> (/var/www/server.js:3:12)     @ module._compile (module.js:456:26)     @ object.module._extensions..js (module.js:474:10)     @ module.load (module.js:356:32)     @ function.module._load (module.js:312:12)     @ module.runmain (module.js:497:10) 

but when this

try { jade = require('jade'); } catch (err) { var jade = require('/usr/local/lib/node_modules/jade/bin/jade'); } 

i can start engine, when enter site see

error: cannot find module 'jade'     @ function.module._resolvefilename (module.js:338:15)     @ function.module._load (module.js:280:25)     @ module.require (module.js:364:17)     @ require (module.js:380:17)     @ new view (/var/www/node_modules/express/lib/view.js:43:49)     @ function.app.render (/var/www/node_modules/express/lib/application.js:488:12)     @ serverresponse.res.render (/var/www/node_modules/express/lib/response.js:798:7)     @ io.sockets.on.socket.on.socket.get.data.message (/var/www/server.js:18:7)     @ callbacks (/var/www/node_modules/express/lib/router/index.js:164:37)     @ param (/var/www/node_modules/express/lib/router/index.js:138:11) 

i tried installing jade nmp install -g jade , npm install jade --global

but nothing... idea im doing wrong? ive checked other posts here , @ other sites no result

--edit--

when make npm install jade --global @ end (before http , http 304 looks fine, no warning or error)

/usr/local/bin/jade -> /usr/local/lib/node_modules/jade/bin/jade jade@0.35.0 /usr/local/lib/node_modules/jade âââ character-parser@1.2.0 âââ commander@2.0.0 âââ mkdirp@0.3.5 âââ transformers@2.1.0 (promise@2.0.0, css@1.0.8, uglify-js@2.2.5) âââ with@1.1.1 (uglify-js@2.4.0) âââ monocle@1.1.50 (readdirp@0.2.5) âââ constantinople@1.0.2 (uglify-js@2.4.0) 

perhaps global install path node not in system path. error in second case subsidiary module express trying require jade.

try local install: assuming jade in package.json (it default, if used express command generate skeleton) run in project root:

npm install -d

this flag installs dependencies


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -