In my case, I was using turborepo, and I forgot to add the build folder of a library in the outputs options of build
"tasks": { "build": { "dependsOn": ["^build"], "outputs": ["dist/**", ".next/**", "!.next/cache/**"] }