areknawo
Error: Cannot find module
Hi,
In a monorepo (based on Turborepo and PNPM workspaces), seemingly at random, I get deployment errors in the form of "Cannot find module" when trying to run a Node.js app. The build and start commands are mostly standard:
-
pnpm build --filter @scope/package
, where the build command bundles the app and frontend and outputs both to a single folder scripts build-node src/index.ts && cp -rf ../../web/dist/ ./dist/public
(this seems to always finish successfully)
- pnpm start --filter @scope/package
, where the start command is standard node ./dist/index.js
I've seen similar issues reported in the past, though all of them had either unclear answers or fixes that weren't applicable to this case.4 replies