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

Cant load ".ejs" view. Please help me. #30

Open
atodhruv opened this issue Apr 5, 2018 · 6 comments
Open

Cant load ".ejs" view. Please help me. #30

atodhruv opened this issue Apr 5, 2018 · 6 comments

Comments

@atodhruv
Copy link

atodhruv commented Apr 5, 2018

Error: Failed to lookup view "error" in views directory "/views"
    at EventEmitter.render (/var/task/node_modules/express/lib/application.js:580:17)
    at ServerResponse.render (/var/task/node_modules/express/lib/response.js:971:7)
    at /var/task/webpack:/app.js:70:7
    at Layer.handle_error (/var/task/node_modules/express/lib/router/layer.js:71:5)
    at trim_prefix (/var/task/node_modules/express/lib/router/index.js:315:13)
    at /var/task/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/var/task/node_modules/express/lib/router/index.js:335:12)
    at next (/var/task/node_modules/express/lib/router/index.js:275:10)
    at Layer.handle_error (/var/task/node_modules/express/lib/router/layer.js:67:12)
    at trim_prefix (/var/task/node_modules/express/lib/router/index.js:315:13)
    at /var/task/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/var/task/node_modules/express/lib/router/index.js:335:12)
    at Immediate.next (/var/task/node_modules/express/lib/router/index.js:275:10)
    at Immediate.<anonymous> (/var/task/node_modules/express/lib/router/index.js:635:15)
    at runCallback (timers.js:674:20)
    at tryOnImmediate (timers.js:645:5)
@jayair
Copy link
Member

jayair commented Apr 6, 2018

@atodhruv It seems like it could find the file in the directory?

@atodhruv
Copy link
Author

atodhruv commented Apr 9, 2018

But there is file named "error.ejs" exist in /views folder
if I remove app.engine('.ejs', ejs); line form app.js witll give following error

Error: Cannot find module 'ejs'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at new View (/var/task/node_modules/express/lib/view.js:81:14)
at EventEmitter.render (/var/task/node_modules/express/lib/application.js:570:12)
at ServerResponse.render (/var/task/node_modules/express/lib/response.js:1008:7)
at /var/task/webpack:/app.js:66:9
at Layer.handle_error (/var/task/node_modules/express/lib/router/layer.js:71:5)
at trim_prefix (/var/task/node_modules/express/lib/router/index.js:315:13)
at /var/task/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/var/task/node_modules/express/lib/router/index.js:335:12)
at next (/var/task/node_modules/express/lib/router/index.js:275:10)
at Layer.handle_error (/var/task/node_modules/express/lib/router/layer.js:67:12)
at trim_prefix (/var/task/node_modules/express/lib/router/index.js:315:13)
at /var/task/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/var/task/node_modules/express/lib/router/index.js:335:12)
at Immediate.next (/var/task/node_modules/express/lib/router/index.js:275:10)
at Immediate. (/var/task/node_modules/express/lib/router/index.js:635:15)
at runCallback (timers.js:674:20)
at tryOnImmediate (timers.js:645:5)
at processImmediate [as _immediateCallback] (timers.js:617:5)

@atodhruv
Copy link
Author

atodhruv commented Apr 9, 2018

I think res.render('view_name') not working

@jayair
Copy link
Member

jayair commented Apr 9, 2018

@atodhruv I'm not sure if I follow. Where did the .ejs files and the views come from?

@atodhruv
Copy link
Author

atodhruv commented Apr 11, 2018

It project structure is
-Project
-- controllers
-- views
-- services
-- node_modules
-- public
-- routes
-- app.js
-- lambda.js
-- serverless.yml
@

@jayair
Copy link
Member

jayair commented Apr 11, 2018

@atodhruv I'm not sure what is going on here but is it related to the starter project?

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