harlan-zw / nuxt-seo

The complete SEO solution for Nuxt.
https://nuxtseo.com
MIT License
1.08k stars 70 forks source link

Cannot start nuxt: Cannot find module 'nitropack' #300

Closed jeannen closed 2 months ago

jeannen commented 2 months ago

Describe the bug

Hey!

When I try to use the whole SEO module, I get the error Cannot start nuxt: Cannot find module 'nitropack'

 ERROR  Error while requiring module /Users/jeannen/Dev/apps/new-app/new-app-front/node_modules/@nuxtjs/sitemap/dist/module.mjs: Error: Cannot find module 'nitropack'            6:46:10 PM
Require stack:
- /Users/jeannen/Dev/apps/new-app/new-app-front/node_modules/@nuxtjs/sitemap/dist/module.mjs

 ERROR  Cannot start nuxt:  Cannot find module 'nitropack'                                                                                                                          6:46:10 PM
Require stack:
- /Users/jeannen/Dev/apps/new-app/new-app-front/node_modules/@nuxtjs/sitemap/dist/module.mjs

  Require stack:
  - node_modules/@nuxtjs/sitemap/dist/module.mjs
  at Module._resolveFilename (node:internal/modules/cjs/loader:1219:15)
  at Function.resolve (node:internal/modules/helpers:133:19)
  at _resolve (node_modules/jiti/dist/jiti.js:1:241814)
  at jiti (node_modules/jiti/dist/jiti.js:1:244531)
  at node_modules/@nuxtjs/sitemap/dist/module.mjs:14:18
  at evalModule (node_modules/jiti/dist/jiti.js:1:247313)
  at jiti (node_modules/jiti/dist/jiti.js:1:245241)
  at requireModule (node_modules/@nuxt/kit/dist/index.mjs:2233:26)
  at loadNuxtModuleInstance (node_modules/@nuxt/kit/dist/index.mjs:2508:92)
  at async installModule (node_modules/@nuxt/kit/dist/index.mjs:2460:47)

HEre are my versions:

"dependencies": {
        "@capacitor/android": "^5.7.4",
        "@capacitor/browser": "^5.2.0",
        "@capacitor/core": "^5.7.4",
        "@capacitor/ios": "^5.7.4",
        "@headlessui/vue": "^1.7.19",
        "@nuxt/content": "^2.13.2",
        "@nuxt/icon": "^1.4.7",
        "@nuxt/image": "^1.7.0",
        "@nuxtjs/plausible": "^1.0.2",
        "@nuxtjs/seo": "^2.0.0-rc.18",
        "@pinia/nuxt": "^0.5.3",
        "capacitor": "^0.5.6",
        "nuxt": "^3.12.4",
        "pinia": "^2.1.7",
        "vue": "^3.4.21",
        "vue-router": "^4.3.0"
    },
    "devDependencies": {
        "@capacitor-community/keep-awake": "^4.0.0",
        "@capacitor/app": "^5.0.7",
        "@capacitor/cli": "^5.7.4",
        "@capacitor/preferences": "^5.0.7",
        "@capacitor/status-bar": "^5.0.7",
        "@nuxt/eslint": "^0.5.1",
        "@nuxtjs/tailwindcss": "^6.12.1",
        "@tailwindcss/forms": "^0.5.7",
        "eslint": "^8.57.0",
        "eslint-config-prettier": "^9.1.0",
        "eslint-plugin-vue": "^9.23.0",
        "nuxt-icon": "^0.6.10",
        "prettier": "^3.2.5",
        "prettier-plugin-organize-attributes": "^1.0.0",
        "prettier-plugin-tailwindcss": "^0.5.12"
    }

I tried removing node_modules, packages lock, and doing npm i, but still the same issue

Is there a way to fix this?

Reproduction

No response

System / Nuxt Info

System:
    OS: macOS 15.0
    CPU: (16) arm64 Apple M3 Max
    Memory: 2.42 GB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.4.0 - /opt/homebrew/bin/node
    npm: 10.8.1 - /opt/homebrew/bin/npm
  Browsers:
    Safari: 18.0
jeannen commented 2 months ago

Issue also happens when I add nuxt sitemap on its own

harlan-zw commented 2 months ago

This is very strange, nitropack is the NPM module name of Nitro, which you are definitely using if you are using Nuxt.

Given that you're the first person to report this, it may be related to your setup so I would need a minimal reproduction to debug further.

The only thing I can suggest is to use pnpm