vue.jsnuxt.jsvitenuxt3.jsnitro

Nuxt3 build .output folder remains empty, nothing copied from .nuxt


I'm encountering a rather strange issue (that occurs after a major refactoring of a web application Vue2+Nuxt2 ===> Vue3+Nuxt3, even though I'm not sure if this is directly related).

The problem: when I run the "nuxt build" command, the generated .output folder contains nothing:

Nuxt3 build .output empty

.output/public/ => empty

.output/server/ => empty

.output/nitro.json => {
  "date": "2024-04-22T11:47:26.045Z",
  "preset": "nitro-prerender",
  "framework": {
    "name": "nuxt",
    "version": "3.11.2"
  },
  "versions": {
    "nitro": "2.9.6"
  },
  "commands": {
    "preview": "npx serve ./public"
  }
}

And that's it.

There is no particular error message during "nuxt build", the logs seem completely normal, apart from a couple of warnings :

> nuxt build

Nuxt 3.11.2 with Nitro 2.9.6                                                                        13:45:51
ℹ Using default Tailwind CSS file                                                 nuxt:tailwindcss 13:45:55
ℹ Compiled types/plugins.d.ts in 513.17ms                                                          13:45:58
ℹ Compiled plugins/client.mjs in 520.62ms                                                          13:45:58
ℹ Building client...                                                                               13:46:00
ℹ vite v5.2.8 building for production...                                                           13:46:00
ℹ ✓ 3137 modules transformed.                                                                      13:46:24   
ℹ ../.nuxt/dist/client/manifest.json                              119.60 kB │ gzip:  12.12 kB      13:46:27
ℹ ../.nuxt/dist/client/_nuxt/ProseCode.CchFRBtv.css                 0.05 kB │ gzip:   0.07 kB      13:46:27   
[...]
ℹ ../.nuxt/dist/client/_nuxt/CBDlt6eF.js                            0.08 kB │ gzip:   0.09 kB      13:46:27   

 WARN                                                                                               13:46:28  
(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.

ℹ ✓ built in 27.67s                                                                                13:46:28   
✔ Client built in 27691ms                                                                          13:46:28
ℹ Building server...                                                                               13:46:28   
ℹ vite v5.2.8 building SSR bundle for production...                                                13:46:28   
ℹ ✓ 1049 modules transformed.                                                                      13:46:49   
ℹ ../.nuxt/dist/server/_nuxt/edit-styles.CJoRU4Dt.mjs                          0.08 kB             13:46:53   
[...]  
ℹ ../.nuxt/dist/server/_nuxt/entry-styles.BrPVGxv3.mjs                         0.34 kB             13:46:53
ℹ ../.nuxt/dist/server/styles.mjs                                              8.52 kB             13:46:53   
[13:46:53] ℹ ../.nuxt/dist/server/_nuxt/edit-styles-1.mjs-WlIG5L6R.js                     0.20 kB │ map:   0.11 kB
[...]
[13:46:54] ℹ ../.nuxt/dist/server/_nuxt/edit-K-fzoRQv.js                                436.49 kB │ map: 101.57 kB
ℹ ✓ built in 26.26s                                                                                13:46:54   
✔ Server built in 26335ms                                                                          13:46:54
ℹ Initializing prerenderer                                                                   nitro 13:46:54

[13:47:22]  WARN  "file:///C:/dev/.................../node_modules/nuxt/dist/core/runtime/nitro/cache-driver.js" is imported by "virtual:#internal/nitro/virtual/storage", but could not be resolved – treating it as an external dependency.

ℹ Prerendering 1 routes

The .nuxt/ folder is generated and filled correctly with all the code expected there, but nothing is then copied into the .output folder.

This causes the command to start the server node .output/server/index.mjs to fail, because index.mjs does not exist.


node:internal/modules/cjs/loader:1147
  throw err;
  ^

Error: Cannot find module 'C:\dev\........\.output\server\index.mjs'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.11.0

Do you have any idea why nothing is generated in my .output? I suspect there must be a configuration error somewhere?

Other information that could be relevant :

Happy to share more relevant info or files if needed :)

Thanks in advance for your help !! 🙏


Solution

  • Not the perfect answer, but I manged to fix it. Happy to give kudos to someone that could explain it !

    I managed to get this working by creating a brand new nuxt project (with nuxt init), which is working fine out-of-the-box, then copying over very carefully all the files and folders from my project into that new project.

    I still have no clue why is wasn't working in the first place, and there doesn't seem to be differences, even according to GIT. 🤔

    However, after doing that, it's now generating properly in the .output folder, as expected !