Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: No default engine was specified and no extension was provided. at new View (D:\Node_Passport\node_modules\express\lib\view.js:61: #96

Open
kinkeyluja opened this issue Jun 25, 2021 · 1 comment

Comments

@kinkeyluja
Copy link

Error: No default engine was specified and no extension was provided.
at new View (D:\Node_Passport\node_modules\express\lib\view.js:61:11)
at Function.render (D:\Node_Passport\node_modules\express\lib\application.js:570:12)
at ServerResponse.render (D:\Node_Passport\node_modules\express\lib\response.js:1012:7)
at D:\Node_Passport\routes\index.js:4:35
at Layer.handle [as handle_request] (D:\Node_Passport\node_modules\express\lib\router\layer.js:95:5)
at next (D:\Node_Passport\node_modules\express\lib\router\route.js:137:13)
at Route.dispatch (D:\Node_Passport\node_modules\express\lib\router\route.js:112:3)
at Layer.handle [as handle_request] (D:\Node_Passport\node_modules\express\lib\router\layer.js:95:5)
at D:\Node_Passport\node_modules\express\lib\router\index.js:281:22
at Function.process_params (D:\Node_Passport\node_modules\express\lib\router\index.js:335:12)
Error: No default engine was specified and no extension was provided.
at new View (D:\Node_Passport\node_modules\express\lib\view.js:61:11)
at Function.render (D:\Node_Passport\node_modules\express\lib\application.js:570:12)
at ServerResponse.render (D:\Node_Passport\node_modules\express\lib\response.js:1012:7)
at D:\Node_Passport\routes\index.js:4:35
at Layer.handle [as handle_request] (D:\Node_Passport\node_modules\express\lib\router\layer.js:95:5)
at next (D:\Node_Passport\node_modules\express\lib\router\route.js:137:13)
at Route.dispatch (D:\Node_Passport\node_modules\express\lib\router\route.js:112:3)
at Layer.handle [as handle_request] (D:\Node_Passport\node_modules\express\lib\router\layer.js:95:5)
at D:\Node_Passport\node_modules\express\lib\router\index.js:281:22
at Function.process_params (D:\Node_Passport\node_modules\express\lib\router\index.js:335:12)

@KishanSeksaria
Copy link

KishanSeksaria commented Oct 8, 2021

Add router.set("view engine","ejs") before taking any requests from the router. Basically, add this line after creating router. I think this should solve your problem. Moreover, as you are inside your routes folder, you need to specify the path of the views folder as well. I think you do that by adding router.use("views", __dirname + "/../views/"). There might be a typo here, but this is the gist of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants