Build Error during npm run dev
# support
n
Hi, I'm trying to run the codebase, I have Node 22, I ran
npm ci
with no errors, but when I try to run
npm run dev
in the server folder I got the next error:
Copy code
npm run dev
@medplum/server@3.2.27 dev
ts-node-dev --poll --respawn --transpile-only --require ./src/otel/instrumentation.ts src/index.ts
[INFO] 20:26:46 ts-node-dev ver. 2.0.0 (using ts-node ver. 10.9.2, typescript ver. 5.7.2)
Error: Cannot find module '/medplum/node_modules/@medplum/core/dist/cjs/index.cjs'
    at createEsmNotFoundErr (node:internal/modules/cjs/loader:1177:15)
    at finalizeEsmResolution (node:internal/modules/cjs/loader:1165:15)
    at resolveExports (node:internal/modules/cjs/loader:590:14)
    at Function.Module._findPath (node:internal/modules/cjs/loader:664:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1126:27)
    at Function.Module._load (node:internal/modules/cjs/loader:981:27)
    at Module.require (node:internal/modules/cjs/loader:1231:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/medplum/packages/server/src/otel/instrumentation.ts:1:1)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
I deleted the node_modules folder and tried again, but it didn't work, I also ran
npm update
but got the same result
n
Also a medplum user- Have you run [npm run build:fast](https://www.medplum.com/docs/contributing/run-the-stack#build)?
r
Thank you so much @nathan-watkins-unityai ! yes that would be my suggestion as well
j
I was facing this issue, until I realised I was running on node 20, I upgrade it to the latest, cleared node_modules and started again and it looks like is gone
n
Do you happen to know which version of node 20? I believe 20.10 is the actual minimum necessary as that's when node changed from
import assertions
to [import attributes](https://nodejs.org/api/esm.html#import-attributes), which [medplum uses](https://github.com/medplum/medplum/blob/b1ef1664e50e431e8fcd544ad565b6af93beef4d/packages/core/esbuild.mjs#L8) in several places
252 Views