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).
3 Replies
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:
occurs because recent versions of
The error is due to an incompatibility between
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:
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:
----------------------<@678484290828238868> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
My apologies. This error was caused by typescript peer dep of 5.5 not the latest.