Solu
Solu

Reputation: 83

Nuxt generate does not generate index.html

I have a Nuxt JS Project on my local maschine and if I launch it, it works with no Problems...But when I try to genereare the files in the dist Folder to Copy it on my Linux Server, it does not work, because there is no index.html....here a shot what it generates me:

enter image description here

As you can see, there is no index.html generated....

Our config is the default nuxt config....would be nice if you could help me :)

Upvotes: 4

Views: 5725

Answers (1)

madc
madc

Reputation: 1744

This often happens, if you have some syntax errors in your pages/index.vue. nuxt:generate won't stop the generation process on error, but skip only this one route. Which leaves you with a missing route.

You should however get a error message similar to this one in your console:

[...]

ℹ Generating pages with full static mode                                                                                      12:22:37

 ERROR   /                                                                                                                    12:22:37

ReferenceError: window is not defined
    at pages/index.js:2832:31
    at pages/index.js:1252:10
    at Object.<anonymous> (node_modules/dat.gui/build/dat.gui.js:18:0)
    at __webpack_require__ (webpack/bootstrap:25:0)
    at Module.<anonymous> (components/scene/App.js:1:0)
    at __webpack_require__ (webpack/bootstrap:25:0)
    at Module.<anonymous> (pages/index.js:4603:11)
    at __webpack_require__ (webpack/bootstrap:25:0)
    at Module.<anonymous> (pages/index.vue?b245:27:0)
    at __webpack_require__ (webpack/bootstrap:25:0)
    at async server.js:3496:21
    at async Promise.all (index 0)
    at async getRouteData (node_modules/.cache/nuxt/utils.js:181:0)
    at async Promise.all (index 0)
    at async setContext (node_modules/.cache/nuxt/utils.js:259:0)
    at async createApp (node_modules/.cache/nuxt/index.js:150:0)

✔ Generated route "/sitemap"                                                                                                  12:22:43
✔ Generated route "/search"

[...]

You can also use nuxt generate --fail-on-error. (see https://nuxtjs.org/docs/2.x/get-started/commands/#fail-on-error)

Upvotes: 4

Related Questions