nuxt-modules / sitemap

Powerfully flexible XML Sitemaps that integrate seamlessly, for Nuxt.
https://nuxtseo.com/sitemap
336 stars 30 forks source link

[6.x] Netlify build breaking #358

Closed cossssmin closed 2 months ago

cossssmin commented 2 months ago

šŸ› The bug

Since @nuxtjs/sitemap@6.0 our builds have started failing on Netlify.

It looks like it's failing because of unocss/core though we're not directly using that - seeing the logs, is it perhaps coming from nuxt-og-image?

šŸ› ļø To reproduce

[private repo, cannot make public on stackblitz]

šŸŒˆ Expected behavior

Successful deploy as currently with v5.x.

ā„¹ļø Additional context

Here's a part of the deploy log, it does a 500 for basically every OG image we have.

Note: currently works fine with @nuxtjs/sitemap@5.3.4

1:29:25 PM: [error] [nuxt] [request error] [unhandled] [500] Cannot find package '@unocss/core' imported from /opt/build/repo/.nuxt/prerender/chunks/_/renderer.mjs
1:29:25 PM:   at packageResolve (node:internal/modules/esm/resolve:854:9)
1:29:25 PM:   at moduleResolve (node:internal/modules/esm/resolve:927:18)
1:29:25 PM:   at defaultResolve (node:internal/modules/esm/resolve:1169:11)
1:29:25 PM:   at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:540:12)
1:29:25 PM:   at ModuleLoader.resolve (node:internal/modules/esm/loader:509:25)
1:29:25 PM:   at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:239:38)
1:29:25 PM:   at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:96:40)
1:29:25 PM:   at link (node:internal/modules/esm/module_job:95:36)
1:29:25 PM: [log] [nitro]   ā”œā”€ /work (117ms)
1:29:25 PM: [log] [nitro]   ā”œā”€ /design (116ms)
1:29:25 PM: [error] [nuxt] [request error] [unhandled] [500] Cannot find package '@unocss/core' imported from /opt/build/repo/.nuxt/prerender/chunks/_/renderer.mjs
1:29:25 PM:   at packageResolve (node:internal/modules/esm/resolve:854:9)
1:29:25 PM:   at moduleResolve (node:internal/modules/esm/resolve:927:18)
1:29:25 PM:   at defaultResolve (node:internal/modules/esm/resolve:1169:11)
1:29:25 PM:   at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:540:12)
1:29:25 PM:   at ModuleLoader.resolve (node:internal/modules/esm/loader:509:25)
1:29:25 PM:   at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:239:38)
1:29:25 PM:   at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:96:40)
1:29:25 PM:   at link (node:internal/modules/esm/module_job:95:36)
1:29:25 PM: [error] [nuxt] [request error] [unhandled] [500] Cannot find package '@unocss/core' imported from /opt/build/repo/.nuxt/prerender/chunks/_/renderer.mjs
1:29:25 PM:   at packageResolve (node:internal/modules/esm/resolve:854:9)
1:29:25 PM:   at moduleResolve (node:internal/modules/esm/resolve:927:18)
1:29:25 PM:   at defaultResolve (node:internal/modules/esm/resolve:1169:11)
1:29:25 PM:   at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:540:12)
1:29:25 PM:   at ModuleLoader.resolve (node:internal/modules/esm/loader:509:25)
1:29:25 PM:   at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:239:38)
1:29:25 PM:   at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:96:40)
1:29:25 PM:   at link (node:internal/modules/esm/module_job:95:36)
1:29:25 PM: [log] [nitro]   ā”œā”€ /strategy (115ms)
1:29:25 PM: [log] [nitro]   ā”œā”€ /contact (114ms)
1:29:25 PM: [log] [nitro]   ā”œā”€ /__og-image__/image/og.jpg (154ms)
1:29:25 PM:   ā”‚ ā”œā”€ā”€ Error: [500] 
1:29:25 PM:   ā”‚ ā””ā”€ā”€ Linked from /

This is our package.json:

{
  "private": true,
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "devDependencies": {
    "@nuxt/content": "2.13.2",
    "@nuxtjs/google-fonts": "^3.2.0",
    "@nuxtjs/sitemap": "^5.3.4",
    "@tailwindcss/forms": "^0.5.8",
    "@tailwindcss/typography": "^0.5.15",
    "@vueuse/core": "^11.0.1",
    "@vueuse/nuxt": "^11.0.3",
    "autoprefixer": "^10.4.20",
    "nuxt": "^3.13.0",
    "nuxt-og-image": "^3.0.0-rc.66",
    "postcss": "^8.4.44",
    "postcss-import": "^16.1.0",
    "sharp": "^0.33.5",
    "tailwindcss": "^3.4.10"
  },
  "dependencies": {
    "radix-vue": "^1.9.5"
  }
}

This is our nuxt.config.ts:

export default defineNuxtConfig({
  css: ['@/assets/css/tailwind.css'],
  modules: [
    '@vueuse/nuxt',
    'radix-vue/nuxt',
    'nuxt-og-image',
    '@nuxt/content',
    '@nuxtjs/sitemap',
    ['@nuxtjs/google-fonts', {
      families: {
        Inter: [300, 400, 500, 600, 700],
      },
      subsets: ['latin', 'latin-ext'],
    }],
  ],
  ogImage: {
    defaults: {
      extension: 'jpg',
    },
  },
  postcss: {
    plugins: {
      tailwindcss: {},
      autoprefixer: {},
    },
  },
  site: {
    url: 'https://alter.email',
  },
  spaLoadingTemplate: false,
  typescript: {
    shim: false,
  },
  devtools: {
    enabled: true
  },
})
harlan-zw commented 2 months ago

Hmm strange can you try doing a nuxi upgrade --force?

This is indeed a dependency of the og image module.

cossssmin commented 2 months ago

Will do and report back, thanks!

cossssmin commented 2 months ago

That did it, thanks man!