我正在尝试一个 zappa 节点应用程序,但除了一个简单的例子之外,我无法让它工作。
我有 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'
我得到一个错误。Zappa 似乎在文件名前面加上了一个 guid。
example/app/views/7b16eeab-de6f-41b0-b196-8f23f4b7237d/index.jade
这是完整的跟踪
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)
这是我的包 json 依赖项的设置方式
"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": "*"
},