nuxt-community / sitemap-module

Sitemap Module for Nuxt 2
https://sitemap.nuxtjs.org
MIT License
689 stars 127 forks source link

Cannot start nuxt: Cannot read properties of undefined (reading 'etag') #274

Closed retroriff closed 2 months ago

retroriff commented 1 year ago

I am getting this error on Nuxt3 after adding the sitemap module to the config file:

"@nuxtjs/sitemap": "^2.4.0",
"nuxt": "3.0.0-rc.13",
ERROR  Cannot start nuxt:  Cannot read properties of undefined (reading 'etag')                     17:41:11

  at setDefaultSitemapOptions (node_modules/@nuxtjs/sitemap/lib/options.js:26:39)
  at registerSitemap (node_modules/@nuxtjs/sitemap/lib/middleware.js:48:13)
  at registerSitemaps (node_modules/@nuxtjs/sitemap/lib/middleware.js:32:5)
  at node_modules/@nuxtjs/sitemap/lib/module.js:50:5
  at Array.forEach (<anonymous>)
  at Object.module (node_modules/@nuxtjs/sitemap/lib/module.js:49:11)
  at async installModule (node_modules/@nuxt/kit/dist/index.mjs:427:3)
  at async initNuxt (node_modules/nuxt/dist/index.mjs:1787:7)
  at async load (node_modules/nuxi/dist/chunks/dev.mjs:6778:9)
  at async Object.invoke (node_modules/nuxi/dist/chunks/dev.mjs:6839:5)
michaelpumo commented 1 year ago

Try this in your Nuxt config for now:

render: {
  etag: {
    weak: false
  }
}
retroriff commented 1 year ago

Thanks, this setting fixes the error. But now it generates a different error when I add i18n: true:

Cannot restart nuxt:  Cannot convert undefined or null to object at
at Function.keys (<anonymous>)
at setDefaultSitemapOptions (node_modules/@nuxtjs/sitemap/lib/options.js:44:28)
at registerSitemap (node_modules/@nuxtjs/sitemap/lib/middleware.js:48:13)
at registerSitemaps (node_modules/@nuxtjs/sitemap/lib/middleware.js:32:5)
at node_modules/@nuxtjs/sitemap/lib/module.js:50:5
at Array.forEach (<anonymous>)
at Object.module (node_modules/@nuxtjs/sitemap/lib/module.js:49:11)
at async installModule (node_modules/@nuxt/kit/dist/index.mjs:427:3)
at async initNuxt (node_modules/nuxt/dist/index.mjs:1787:7)
at async load (node_modules/nuxi/dist/chunks/dev.mjs:6778:9)
at async _applyPromised (node_modules/nuxi/dist/chunks/dev.mjs:6712:10)

When I remove i18n: true there's no error but the sitemap returns a 404.

kilobyte2007 commented 1 year ago

@retroriff I don't think this module is compatible with Nuxt 3. See this repo for the current solution - https://github.com/benoitdemaegdt/nuxt3-sitemap

d3xter-dev commented 1 year ago

Check https://www.npmjs.com/package/@funken-studio/sitemap-nuxt-3 for a version which works with Nuxt 3 :)