N
Nuxt2w ago
holloway

Nuxt 4 TypeScript vue-tsc upgrade error "Compiler option '--noEmit' may not be used with '--build"

The Nuxt4 Upgrade Guide says to use nuxt prepare && vue-tsc -b --noEmit however this results in an error with latest Nuxt (4.0.3) and vue-tsc (3.0.5).
$ npm run typecheck
> red@0.0.1 typecheck
> nuxt prepare && vue-tsc -b --noEmit
ℹ Nuxt Icon server bundle mode is set to local ✔ Types generated in .nuxt
error TS5094: Compiler option '--noEmit' may not be used with '--build'.
$ npm run typecheck
> red@0.0.1 typecheck
> nuxt prepare && vue-tsc -b --noEmit
ℹ Nuxt Icon server bundle mode is set to local ✔ Types generated in .nuxt
error TS5094: Compiler option '--noEmit' may not be used with '--build'.
3 Replies
kapa.ai
kapa.ai2w ago
Hi @holloway. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error you are seeing:
error TS5094: Compiler option '--noEmit' may not be used with '--build'.
error TS5094: Compiler option '--noEmit' may not be used with '--build'.
occurs because recent versions of vue-tsc (and TypeScript itself) do not allow the --noEmit flag to be used together with the --build (-b) flag. The Nuxt 4 Upgrade Guide suggests using:
nuxt prepare && vue-tsc -b --noEmit
nuxt prepare && vue-tsc -b --noEmit
However, with the latest vue-tsc (3.0.5) and Nuxt (4.0.3), this combination is no longer valid and results in the error you described. What to do instead? The knowledge sources do not provide an updated, official workaround for this specific error with the latest vue-tsc. The guide still recommends the now-invalid command, and there is no mention of an alternative approach for type-checking with project references in the provided documentation. Therefore, you may need to check for updates in the Nuxt documentation or the vue-tsc changelog for a new recommended approach. Summary:
The error is due to an incompatibility between --noEmit and --build flags in recent vue-tsc/TypeScript versions. The Nuxt documentation currently suggests a command that is no longer valid, and the knowledge sources do not provide an updated solution for this scenario. You may need to monitor the Nuxt docs or vue-tsc repository for an official update or workaround for type-checking with project references in Nuxt 4 TypeScript Configuration Splitting. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@678484290828238868> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
holloway
hollowayOP2w ago
My apologies. This error was caused by typescript peer dep of 5.5 not the latest.

Did you find this page helpful?