Error: Cannot find module '/opt/render/project/src/build/server/index.js'

My deployment has been working in the past. I pushed a new commit and I see the server fails with Error: Cannot find module '/opt/render/project/src/build/server/index.js'

I used ssh and then cd /opt/render/project/src/build/server and I can cat index.js

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const express_1 = __importDefault(require("express"));
...
// Get port from environment and store in Express
const port = parseInt(process.env.PORT || '3000', 10);
app.set('port', port);
// Start server
app.listen(app.get('port'), () => {
    console.log(`Server running on port ${app.get('port')}`);
});

So everything looks fine… Perhaps there is a timing bug or something where those files don’t exist during server startup?

I guess when I ssh it is into the active server and not the failed build server.

I was able to reproduce my issues locally via

npm install —production
npm run start```

Commenting in case this helps someone else down the road.