pnpm i
pnpm run dev
pnpm run test
[error] [nitro] Error: Could not load /home/myuser/workspace/nuxt-cache-vitest/.nuxt/dist/server/styles.mjs (imported by node_modules/.pnpm/nuxt@3.11.2_@unocss+reset@0.59.0_floating-vue@5.2.2_unocss@0.59.0_vite@5.2.8/node_modules/nuxt/dist/core/runtime/nitro/renderer.js): ENOENT: no such file or directory, open '/home/myuser/workspace/nuxt-cache-vitest/.nuxt/dist/server/styles.mjs'
undefined
failed to load config from /home/myuser/workspace/nuxt-cache-vitest/vitest.config.ts
Unhandled Error
[Error: Could not load /home/myuser/workspace/nuxt-cache-vitest/.nuxt/dist/server/styles.mjs (imported by node_modules/.pnpm/nuxt@3.11.2_@unocss+reset@0.59.0_floating-vue@5.2.2_unocss@0.59.0_vite@5.2.8/node_modules/nuxt/dist/core/runtime/nitro/renderer.js): ENOENT: no such file or directory, open '/home/myuser/workspace/nuxt-cache-vitest/.nuxt/dist/server/styles.mjs']
pnpm i
pnpm run build
pnpm run test
# Silently fails, seems to run "pnpm run build" again
> nuxt-app@ test /home/myuser/workspace/nuxt-cache-vitest
> vitest
[success] [nitro] Generated public .output/public
[info] [nitro] Building Nuxt Nitro server (preset: `node-server`)
[success] [nitro] Nuxt Nitro server built
├─ .output/server/chunks/_/error-500.mjs (5.09 kB) (2.12 kB gzip)
├─ .output/server/chunks/_/error-500.mjs.map (240 B) (174 B gzip)
├─ .output/server/chunks/build/client.manifest.mjs (2.49 kB) (519 B gzip)
├─ .output/server/chunks/build/client.manifest.mjs.map (1.61 kB) (374 B gzip)
├─ .output/server/chunks/routes/renderer.mjs (11.8 kB) (3.83 kB gzip)
├─ .output/server/chunks/routes/renderer.mjs.map (665 B) (294 B gzip)
├─ .output/server/chunks/runtime.mjs (165 kB) (40.1 kB gzip)
├─ .output/server/chunks/runtime.mjs.map (4.38 kB) (939 B gzip)
├─ .output/server/chunks/virtual/_virtual_spa-template.mjs (94 B) (100 B gzip)
├─ .output/server/chunks/virtual/_virtual_spa-template.mjs.map (112 B) (111 B gzip)
├─ .output/server/index.mjs (291 B) (192 B gzip)
└─ .output/server/package.json (741 B) (309 B gzip)
Σ Total size: 1.56 MB (375 kB gzip)
[success] [nitro] You can preview this build using `node .output/server/index.mjs`
Workarounds
rm -rf node_modules .nuxt .output
pnpm i
pnpm run test
There seems to be an issue with Vitest when a cache is present
Reproduction
Reproduction repo: https://github.com/FranckKe/nuxt-cache-vitest
First run works as expected
Workarounds
or