Node.js找不到目录
我是Node.js的新手,我正在尝试部署一个用Node.js编写的,可在github上获得的开源项目( https://github.com/pyvandenbussche/lov )。
当我尝试运行该应用程序时,出现以下错误:
Error: Failed to lookup view "500" in views directory "undefined/app/views" at Function.app.render (/home/me/Documents/lov/node_modules/express/lib/application.js:493:17)
我知道有些错误来自下面app.set('views', config.root + '/app/views')
代码: app.set('views', config.root + '/app/views')
因为config.root没有定义,所以我想知道我应该在哪里定义这个。
Node.js是否自动执行?
在server.js
导入的config
对象来自config/config.js
文件 。
所以你只需要添加root : someDir
(即process.cwd()
)到development(和其他的envs相应),参见:
module.exports = { development: { root: process.cwd() ...