Answer the question
In order to leave comments, you need to log in
How to correctly write paths for path?
Wrote my first project.
/server.js - entry point for development
/build/bundle.server.js - transpiled entry point ( server.js ) for production
/views/index.ejs - ejs template
Problem with ejs template. In /server.js I have a path
: the transpiled bundle.server.js is launched from the subdirectory (build)
turns into /build/views and, of course, the template is not found.
Everything works for me locally, tk. going to webpack, and there you can put in the config
It works.
But here he uploaded the site to azure; specified entry point /build/bundle.server.jsapp.set("views", path.join(__dirname, 'views'))
path.join(__dirname, 'views')
{ node: { __dirname: true } }
and the template is not found there.
If you manually put
That on azure, everything will work, but on my computer it no longer exists.
This, in fact, is the question. How to solve this problem? How to spell path correctly?
Maybe path works differently in different node versions? My locally old one costs 0.10.25. On azure by default 4+. app.set("views", '../views')
Answer the question
In order to leave comments, you need to log in
This, as I understand it , is the problem of getting the path of the project's root directory . The first answer on the link offers a lot of options, try the one called NODE_PATH environmental variable.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question