Express js gives an error the Assembly React?

Collected React project (create-react-app) through the yarn build. The Assembly can be run through serve-s build (works correctly)

Server express prescribed
app.use(express.static(path.join(__dirname + "../../client/build")));

 app.get("*", (req, res) => {
 Res. sendFile(path.resolve(__dirname, "..", "..", "client", "build", "index.html"));

When you start the server and logging in the browser, the server sends the file, but the id element=root which should be added the react by means of the content - empty.
If in the file index.html manually what to prescribe - is to be displayed.

In the console error
April 7th 20 at 10:47
1 answer
April 7th 20 at 10:49
It helped, replaced the code above to this
const root = require('path').join(__dirname, '..', '..', 'client', 'build')
 app.get("*", (req, res) => {
 Res. sendFile('index.html', { root });

Find more questions by tags Node.jsExpress.jsReact