24.5.2 production build fails with missing tsc.js

I have a Vaadin 24.5.2 app that runs in development mode, both through maven and by running the Spring Boot app through my IDE. However, I’m unable to run mvn -Pproduction package, I get this error:

[ERROR] Error: Cannot find module '../lib/tsc.js'
[ERROR] Require stack:
[ERROR] - /Users/mhellber/Desktop/nps/node_modules/.bin/tsc
[ERROR]     at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
[ERROR]     at Module._load (node:internal/modules/cjs/loader:922:27)
[ERROR]     at Module.require (node:internal/modules/cjs/loader:1143:19)
[ERROR]     at require (node:internal/modules/cjs/helpers:121:18)
[ERROR]     at Object.<anonymous> (/Users/mhellber/Desktop/nps/node_modules/.bin/tsc:2:1)
[ERROR]     at Module._compile (node:internal/modules/cjs/loader:1256:14)
[ERROR]     at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
[ERROR]     at Module.load (node:internal/modules/cjs/loader:1119:32)
[ERROR]     at Module._load (node:internal/modules/cjs/loader:960:12)
[ERROR]     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
[ERROR]   code: 'MODULE_NOT_FOUND',
[ERROR]   requireStack: [ '/Users/mhellber/Desktop/nps/node_modules/.bin/tsc' ]
[ERROR] }

Any ideas what the problem might be?

Solved by deleting node_modules and re-running :man_shrugging:

That obviously “should never happen”, but it did again :man_shrugging:

For this kind of situations I have a following powerful alias in my shell init script :sunglasses:

alias chachacha="mvn com.vaadin:vaadin-maven-plugin:dance"
3 Likes