nuxt-modules / sitemap

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

TypeError: Could not load virtual:#nuxt-simple-sitemap/pages.mjs (imported by node_modules/nuxt-simple-sitemap/dist/runtime/routes/debug.mjs): Cannot read properties of null (reading 'replace') #243

Closed toddpadwick closed 8 months ago

toddpadwick commented 8 months ago

Hi there. I am getting the following error when trying to run sitemap on node > 18. was running fine on node 16, but had to upgrade to node >18 for another plugin.

[nitro 15:47:21]  ERROR  TypeError: Could not load virtual:#nuxt-simple-sitemap/pages.mjs (imported by node_modules/nuxt-simple-sitemap/dist/runtime/routes/debug.mjs): Cannot read properties of null (reading 'replace')

[nitro 15:47:21]
 ERROR  This module cannot be imported in server runtime. [importing @nuxt/kit from node_modules/nuxt-simple-sitemap/dist/runtime/util/pageUtils.mjs]                                       15:47:21
{
  "private": true,
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "engines": {
    "node": "20.x"
  },
  "devDependencies": {
    "@nuxtjs/sitemap": "^5.1.1",
    "@sanity/client": "^6.15.2",
    "@types/lodash-es": "^4.17.12",
    "@types/node": "^20.11.25",
    "@vueuse/core": "^10.9.0",
    "@vueuse/nuxt": "^10.9.0",
    "netlify-cli": "17.18.1",
    "nuxt": "^3.10.3",
    "nuxt-schema-org": "^3.3.4",
    "sass": "^1.71.1",
    "sass-loader": "^14.1.1",
    "typescript": "^5.4.2"
  },
  "dependencies": {
    "@lottiefiles/lottie-player": "^2.0.4",
    "@nuxt/image": "^1.4.0",
    "@nuxtjs/robots": "^3.0.0",
    "@nuxtjs/sanity": "^1.8.3",
    "@pinia-plugin-persistedstate/nuxt": "^1.2.0",
    "@pinia/nuxt": "^0.5.1",
    "@portabletext/vue": "^1.0.6",
    "@sanity/image-url": "^1.0.2",
    "@shimyshack/uid": "^0.1.9",
    "@vueuse/components": "^10.9.0",
    "node-fetch": "^3.3.2",
    "nuxt-jsonld": "^2.0.8",
    "pinia": "^2.1.7",
    "pinia-plugin-persistedstate": "^3.2.1",
    "pluralize": "^8.0.0",
    "slugify": "^1.6.6",
    "vue-carbonbadge": "^2.0.0",
    "vue-scrollto": "^2.20.0",
    "vue3-lottie": "^3.2.0"
  },
  "peerDependencies": {
    "axios": "^1.6.7",
    "consola": "3.2.3"
  },
  "overrides": {
    "vue": "latest"
  }
}
toddpadwick commented 8 months ago

This was down to an issue with my local environment. closed as solved.

mir1198yusuf commented 5 months ago

@toddpadwick facing similar issue, what was your local env issue causing this error ?

I am getting this

TypeError: Could not load virtual:#sitemap/global-sources.mjs (imported by node_modules/@nuxtjs/sitemap/dist/runtime/nitro/sitemap/urlset/sources.mjs): Converting circular structure to JSON
    --> starting at object with constructor 'Array'
    --- index 4 closes the circle