Skip to content

fix: Issue in detecting the version for @nuxtjs/robots pakcage #379

@cyrilf

Description

@cyrilf

🐛 The bug

When I build my Nuxt project the following error occurs:

[@nuxtjs/sitemap 9:35:41 AM] WARN You are using @nuxtjs/robots vfalse. For the best compatibility, please upgrade to @nuxtjs/robots v4.0.0 or higher.

resulting further down in the build to:
Duplicated imports "getPathRobotConfig", the one from "/home/x/dev-project/node_modules/@nuxtjs/sitemap/dist/runtime/nitro/composables/getPathRobotConfigPolyfill" has been ignored and "/home/x/dev-project/node_modules/@nuxtjs/robots/dist/runtime/nitro/composables/getPathRobotConfig.js" is used

Reproduction

Use the reproduction link below and watch the console. The warning messages are incorrectly displayed but by selecting the text in the console, you can read them entirely.

OR

Create a new Nuxt project:
npx nuxi@latest init test-seo

Then go in this project
cd test-seo

Then install nuxt-seo
npx nuxi module add @nuxtjs/seo

Then run a build:
npm run build

You will see the error messages mentioned earlier.

Context

The error seems to occur in that hook which is calling this function

Maybe related to this older issue

🛠️ To reproduce

https://stackblitz.com/edit/nuxt-starter-vtmy8d?file=package.json

🌈 Expected behavior

The sitemap module should correctly find my nuxtjs/robots version and I see no error or warning in the console.

ℹ️ Additional context

These are the dependencies:

"dependencies": {
    "@nuxtjs/seo": "^2.0.0-rc.23",
    "nuxt": "^3.14.0",
    "vue": "latest",
    "vue-router": "latest"
  }

I'm using npm version: 10.2.4 and node version v20.11.0


Maybe fixed by nuxt/nuxt#29793 ? 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions