Somehow files are missing from node_modules in the Deployment
When hosting my application on vercel, visiting anything under /journey/ produces the following error:
Uncaught Exception: [Error: ENOENT: no such file or directory, open '/vercel/path0/node_modules/db-hafas-stations/full.ndjson'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/vercel/path0/node_modules/db-hafas-stations/full.ndjson'
}
This only happens on vercel. It referrrs to a submodule of db-vendo-client which is a library my code uses.
Here is the relevant lines (src/components/journey/StopsContainer.tsx):
useEffect(() => {
if (!risId) return;
async function fetchJourney() {
setVendoLoading(true);
const vendoData = JSON.parse(await getVendoJourney(risId));
if (!vendoData) {
setVendoLoading(false);
return;
}
setStopsWithVendo((prev) =>
prev.map((stop) => {
const vendoStop = vendoData.stopovers?.find(
(vendoStop: any) => vendoStop.stop?.id === stop.station.evaNo
);
if (!vendoStop) return stop;
return {
...stop,
loadFactor: vendoStop.loadFactor,
};
})
);
setVendoLoading(false);
}
fetchJourney();
}, [risId]);
"build": "next build && ls node_modules/db-hafas-stations/",
I have added a ls statement to the build command to output the contents of said module.
This however outputs the following:
[11:18:59.304] data.ndjson
[11:18:59.305] full.ndjson
[11:18:59.305] index.js
[11:18:59.305] license-data.md
[11:18:59.305] license.md
[11:18:59.305] package.json
[11:18:59.306] readme.md
I have no clue what is happening. All modules are installed correctly. No errors during build process or on any other pages. Thank you in advance