Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
cyrilf opened this issue Nov 5, 2024 · 3 comments
Closed

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

cyrilf opened this issue Nov 5, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@cyrilf
Copy link

cyrilf commented Nov 5, 2024

🐛 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 ? 🤔

@cyrilf cyrilf added the bug Something isn't working label Nov 5, 2024
@harlan-zw
Copy link
Collaborator

Thanks for raising this, it seems like an upstream bug in Nuxt. I've set up a graceful fallback if the version read fails.

@cyrilf
Copy link
Author

cyrilf commented Nov 5, 2024

Nice, thanks for the quick answer and fix! 👍
Do you think I need to raise an issue on the Nuxt repo or is this one solving it already?

@harlan-zw
Copy link
Collaborator

Yes that should do the trick!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants