Express Error: No default engine was specified and no extension was provided
来源:互联网 发布:淘宝发错货的处理规定 编辑:程序博客网 时间:2024/06/07 09:25
http://stackoverflow.com/questions/23595282/error-no-default-engine-was-specified-and-no-extension-was-provided
Error: No default engine was specified and no extension was provided. at new View (...\node_modules\express\lib\view.js:41:42) at Function.app.render (...\node_modules\express\lib\application.js:484:12) at ServerResponse.res.render (...\node_modules\express\lib\response.js:783:7) at Layer.handle (...\app.js:123:7) at trim_prefix (...\node_modules\express\lib\router\index.js:225:17) at c (...\node_modules\express\lib\router\index.js:198:9) at Function.proto.process_params (...\node_modules\express\lib\router\index.js:253:12) at next (...\node_modules\express\lib\router\index.js:189:19) at next (...\node_modules\express\lib\router\index.js:202:7) at next (...\node_modules\express\lib\router\index.js:166:38)
Answer: The res.render stuff will throw an error, if you're not using a view engine.
If you just want to serve json replace the res.render('error', { error: err });
lines in your code with:
res.json({ error: err })
PS: People usually also have message in the returned object:
res.status(err.status || 500);res.json({ message: err.message, error: err});
0 0
- Express Error: No default engine was specified and no extension was provided
- iOS运行出现No application was specified.
- iOS运行出现No application was specified.
- no column name was specified for column
- UserWarning: No parser was explicitly specified
- No value was provided for the parameter ‘appIdName’ when provisioning
- No value was provided for the parameter ‘appIdName’ when provisioning
- No orientation specified, and the default is
- No default view was found for object type 10201 and query type 2
- No selector attribute (cookie/header/name/parameter) was specified
- No orientation specified, and the default is horizontal.
- android No orientation specified, and the default is horizontal.
- No orientation specified, and the default is horizontal.
- No orientation specified, and the default is horizontal.
- No orientation specified, and the default is horizontal.
- No orientation specified, and the default is horizontal.
- Android—No orientation specified, and the default is horizontal.
- 问题解决: No module named requests, __init__.py:166: UserWarning: No parser was explicitly specified
- 解决pod安装 requires Ruby version >= 2.2.2
- 内存泄漏问题
- 懒加载(LAZY)在View层报错的解决方法: OpenSessionInViewFilter
- linux Sybase ASE 查询当前版本和所有数据库
- C语言入门(二十)结构体
- Express Error: No default engine was specified and no extension was provided
- myeclipse加载maven工程提示pom.xml无法解析!
- LeetCode 231. Power of Two
- awk 之 in NR FNR 用法实例
- log4j2 使用详解
- 设计模式之我见(四)
- Android 学习记录(持续更新)
- codeforces 241 E Flights
- 使用 GNU Libtool 创建库