Reputation: 560
I am trying a zappa node application and am unable to get it working beyond a trivial example.
I have application.coffee
require('zappajs') ->
@set views: "#{__dirname}/views"
@set 'view engine': 'jade'
@use 'bodyParser', 'methodOverride', @app.router, 'static'
@configure
development: => @use errorHandler: {dumpExceptions: on}
production: => @use 'errorHandler'
@get '/': -> @render 'index'
and i am getting an error. Zappa seems to be prepending a guid to the file name.
example/app/views/7b16eeab-de6f-41b0-b196-8f23f4b7237d/index.jade
Here is the complete trace
Error: ENOENT, no such file or directory '/Users/irfn/project/example/app/views/7b16eeab-de6f-41b0-b196-8f23f4b7237d/index.jade'
at Object.fs.openSync (fs.js:338:18)
at Object.fs.readFileSync (fs.js:182:15)
at Object.rethrow (/Users/irfn/project/example/node_modules/jade/lib/runtime.js:155:27)
at parse (/Users/irfn/project/example/node_modules/jade/lib/jade.js:116:13)
at Object.exports.compile (/Users/irfn/project/example/node_modules/jade/lib/jade.js:163:9)
at Function.exports.compile (/Users/irfn/project/example/node_modules/zappajs/node_modules/express/lib/view.js:68:33)
at ServerResponse.res._render (/Users/irfn/project/example/node_modules/zappajs/node_modules/express/lib/view.js:417:18)
at ServerResponse.res.render (/Users/irfn/project/example/node_modules/zappajs/node_modules/express/lib/view.js:318:17)
at Object.zappa.app.app.(anonymous function).apply.concat.render (/Users/irfn/project/example/node_modules/zappajs/lib/zappa.js:593:33)
at Object.zappa.app.app.(anonymous function).apply.concat.ctx.render (/Users/irfn/project/example/node_modules/zappajs/lib/zappa.js:545:31)
Here is how my package json dependencies are setup
"dependencies": {
"coffee-script": "1.3.3",
"underscore": ">= 1.3.3",
"stylus": ">= 0.28.2",
"zappajs": ">= 0.3.10",
"jade": ">= 0.18.0"
},
"devDependencies": {
"watchr": "*",
"mocha": "*",
"chai": "*",
"request": "*"
},
Upvotes: 3
Views: 418
Reputation: 66
Came across this myself - did not have the time to track down the cause but there is an easy workaround: instead of
@get / : ->
@render index: {key:value}
use the more old school connect-style
@app.get '/', (req,res) ->
res.render 'index', {key:value}
Hope this helps you get over the hump.
PS: Come to think of it, I assume it might have something to do with the way zappa evaluates coffee(k/c)up templates by default. In this case it might be trying to apply that logic to jade which breaks.
Upvotes: 5