快速错误500:无法查找视图" index.html"在views目录" / app / views"

时间:2015-10-28 00:07:08

标签: angularjs node.js express heroku

// App Configuration
app.configure('development', function() {
  app.use(express.static(path.join(__dirname, '.tmp')));
  app.use(express.static(path.join(__dirname, 'app')));
  app.use(express.errorHandler());
  app.set('views', __dirname + '/app/views');
});

这是我的渲染文件配置

  

错误:无法查找视图" index.html"在views目录" / app / views"   2015-10-27T23:56:04.240297 + 00:00 app [web.1]:在Function.app.render(/app/node_modules/express/lib/application.js:493:17)

     

2015-10-27T23:56:04.240299 + 00:00 app [web.1]:at ServerResponse.res.render(/app/node_modules/express/lib/response.js:798:7)

     

2015-10-27T23:56:04.240300 + 00:00 app [web.1]:at /app/lib/config/routes.js:82:9

     

2015-10-27T23:56:04.240300 + 00:00 app [web.1]:在回调中(/app/node_modules/express/lib/router/index.js:164:37)

     

2015-10-27T23:56:04.240301 + 00:00 app [web.1]:at param(/app/node_modules/express/lib/router/index.js:138:11)

     

2015-10-27T23:56:04.240302 + 00:00 app [web.1]:传递(/app/node_modules/express/lib/router/index.js:145:5)

     

2015-10-27T23:56:04.240302 + 00:00 app [web.1]:在Router._dispatch(/app/node_modules/express/lib/router/index.js:173:5)

     

2015-10-27T23:56:04.240303 + 00:00 app [web.1]:at Object.router(/app/node_modules/express/lib/router/index.js:33:10)

     

2015-10-27T23:56:04.240304 + 00:00 app [web.1]:at next(/app/node_modules/express/node_modules/connect/lib/proto.js:193:15)

     

2015-10-27T23:56:04.240306 + 00:00 app [web.1]:在SessionStrategy.strategy.pass(/app/node_modules/passport/lib/middleware/authenticate.js:318:9)< / p>      

2015-10-27T23:56:04.240307 + 00:00 app [web.1]:在SessionStrategy.authenticate(/app/node_modules/passport/lib/strategies/session.js:67:10)

     

2015-10-27T23:56:04.240307 + 00:00 app [web.1]:尝试时(/app/node_modules/passport/lib/middleware/authenticate.js:341:16)

     

2015-10-27T23:56:04.240308 + 00:00 app [web.1]:at Object.authenticate [as handle](/app/node_modules/passport/lib/middleware/authenticate.js:342:7 )

     

2015-10-27T23:56:04.240309 + 00:00 app [web.1]:at next(/app/node_modules/express/node_modules/connect/lib/proto.js:193:15)

     

2015-10-27T23:56:04.240310 + 00:00 app [web.1]:at Object.initialize [as handle](/app/node_modules/passport/lib/middleware/initialize.js:62:5 )

     

2015-10-27T23:56:04.240311 + 00:00 app [web.1]:at next(/app/node_modules/express/node_modules/connect/lib/proto.js:193:15)

任何帮助将不胜感激。谢谢

1 个答案:

答案 0 :(得分:0)

你有app.get('/index.html',function(req,res){res.render('index.html');}); ??

请参阅此示例,了解路由示例https://github.com/AugustoL/website/blob/master/routes.js,它是我的网站。

在这里你有我的server.js,也许它对你有所帮助https://github.com/AugustoL/website/blob/master/server.js