Search code examples
node.jsvue.jsnpmnuxt.jssitemap

@nuxtjs/sitemap error says: Cannot find package 'nitropack'


I have a nuxtjs v2 webapp and have installed @nuxtjs/sitemap module, After I have installed that plugin, everytime I try to run npm run dev or build or generate this error is returned:

Cannot find package 'nitropack' imported from D:\Web Development\...\node_modules\@nuxtjs\sitemap\dist\module.mjs

Iam not using 'nitropcak' and I dn't know what it is..

I searched a lot and not found an similar problem, hope anyone can help

I have cleaned npm cache, reinstalled dependencies and moved the whole project on linux system, and all returned same error with same message.

my nuxt.config.js looks like this:

        modules: [
        // https://go.nuxtjs.dev/axios , https://go.nuxtjs.dev/pwa
        "@nuxtjs/axios",
        "@nuxtjs/pwa",
        "@nuxtjs/auth-next",
        "nuxt-route-meta",
        "@nuxtjs/axios",
        "cookie-universal-nuxt",
        "@nuxtjs/google-gtag",
        "@nuxtjs/sitemap",
    ],
    sitemap: {
        hostname: 'https://url.com', // Replace this with your domain
        gzip: true,
        exclude: [
            '/secret-page',
            '/admin/**'
        ],
        // Add any other configuration options you need
    },

Solution

  • Iam not using 'nitropcak' and I dn't know what it is..

    nitropack is being used by @nuxtjs/sitemap, as the error message also suggests.

    As you're using Nuxt 2, I would suggest to verify that you are using version 2.x of the @nuxtjs/sitemap (https://www.npmjs.com/package/@nuxtjs/sitemap/v/2.4.0), as stated on their documentation:

    If you intend to use this module for Nuxt 2, you should stay on version 2.x.