V
V
VoisHunter2019-05-14 16:10:41
Node.js
VoisHunter, 2019-05-14 16:10:41

How to solve an error when starting a Node.js project?

When starting www.js, an error occurs, tell me where to dig?

Error: Failed to lookup view "/var/www/html/dist/index.hbs" in views directory "/var/www/html/сайт/dist-server/server/views"
    at Function.render (/var/www/html/сайт/node_modules/express/lib/application.js:580:17)
    at ServerResponse.render (/var/www/html/сайт/node_modules/express/lib/response.js:1008:7)
    at /var/www/html/сайт/dist-server/server/routes/index.route.js:19:22
    at Layer.handle [as handle_request] (/var/www/html/сайт/node_modules/express/lib/router/layer.js:95:5)
    at next (/var/www/html/сайт/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/var/www/html/сайт/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/var/www/html/сайт/node_modules/express/lib/router/layer.js:95:5)
    at /var/www/html/сайт/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/var/www/html/сайт/node_modules/express/lib/router/index.js:335:12)
    at next (/var/www/html/сайт/node_modules/express/lib/router/index.js:275:10)
    at Function.handle (/var/www/html/сайт/node_modules/express/lib/router/index.js:174:3)
    at router (/var/www/html/сайт/node_modules/express/lib/router/index.js:47:12)
    at Layer.handle [as handle_request] (/var/www/html/сайт/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/var/www/html/сайт/node_modules/express/lib/router/index.js:317:13)
    at /var/www/html/сайт/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/var/www/html/сайт/node_modules/express/lib/router/index.js:335:12)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roy2player, 2021-05-10
@Roy2player

"To work with view engines, Express has a number of global settings that we can set. First of all, this is the view engine setting, which sets the view engine to use, and views, which sets the path to the folder with views within the project (if this setting is not set, it defaults to a folder named views)."
https://metanit.com/web/nodejs/4.7.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question