How to register the path for path?

Write your first draft.
/server.js - the entry point for development
/build/bundle.server.js - transperency the entry point (server.js) for production
/views/index.ejs - ejs template

The problem with ejs template. In /server.js I spelled out the path:
app.set("views", path.join(__dirname, 'views'))

But since transparency bundle.server.js is run from the subdirectory (build)
path.join(__dirname, 'views')
turns into /build/views and, of course, the pattern finds.

I have everything working locally, because going vebacom, and there you can put in the config
{ node: { __dirname: true } }
It works.
But they put a website on azure; indicated entry point /build/bundle.server.js and there is a pattern finds.
If you manually put
app.set("views", '../views')
On azure all is working, but on my comp anymore.

This, in fact, a question. How to solve this problem? How to register path?
Maybe the path is different on different versions of node? I have locally old is 0.10.25. On azure by default 4+.
July 12th 19 at 16:54
1 answer
July 12th 19 at 16:56
This I understand is a problem getting the path to the root directory of the project. The first answer at the link offers a lot of options, try the option called NODE_PATH environmental variable.

Find more questions by tags Node.js