shopware / frontends

Shopware Frontends is a framework for building custom, headless storefronts with Shopware 6.
https://frontends.shopware.com
MIT License
175 stars 49 forks source link

[BUG] Error: Cannot find module '@shopware-pwa/cms-base/module' #1380

Closed lionel-addvanto closed 2 days ago

lionel-addvanto commented 1 week ago

Is there an existing issue for this?

Current Behavior

I have installed

{
  "name": "demo-store",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "nuxt dev",
    "build": "nuxt build",
    "start": "nuxt start",
    "lint": "eslint . --fix",
    "typecheck": "nuxi typecheck",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "analyze": "nuxt analyze",
    "format": "prettier --write --list-different ."
  },
  "dependencies": {
    "@iconify/tools": "^4.0.7",
    "@nuxt/image": "1.8.1",
    "@nuxtjs/google-fonts": "^3.2.0",
    "@nuxtjs/tailwindcss": "^6.12.2",
    "@shopware-pwa/composables-next": "^1.3.0",
    "@shopware-pwa/helpers-next": "^1.1.0",
    "@shopware-pwa/nuxt3-module": "^1.0.5",
    "@shopware-pwa/shopware-6-client": "^1.6.1",
    "@shopware-pwa/types": "^1.0.2",
    "@shopware/api-client": "^1.0.2",
    "@vuelidate/core": "^2.0.3",
    "@vuelidate/validators": "^2.0.4",
    "@vueuse/nuxt": "^11.1.0",
    "leaflet-gesture-handling": "^1.2.2",
    "nuxt-lazy-load": "^3.0.4",
    "nuxt-multi-cache": "^3.3.3",
    "nuxt-svgo": "^4.0.6",
    "nuxt-swiper": "^1.2.2",
    "requrl": "^3.0.2",
    "sitemap": "^8.0.0",
    "swiper": "^11.1.14",
    "vue": "^3.5.12",
    "vue-leaflet-markercluster": "^0.6.1"
  },
  "devDependencies": {
    "@iconify-json/carbon": "^1.2.3",
    "@nuxt/devtools": "^1.6.0",
    "@nuxt/eslint": "^0.6.0",
    "@nuxtjs/i18n": "^8.5.5",
    "@shopware-pwa/cms-base": "^1.0.5",
    "@zadigetvoltaire/nuxt-gtm": "^0.0.13",
    "@zoom-avant/nuxt": "^0.7.1",
    "eslint": "^9.13.0",
    "maska": "^3.0.3",
    "nuxt": "^3.13.2",
    "nuxt-security": "^2.0.0",
    "nuxt3-leaflet": "^1.0.13",
    "prettier": "^3.3.3",
    "prettier-plugin-tailwindcss": "^0.6.8",
    "sass": "^1.80.3",
    "typescript": "^5.6.3"
  },
  "engines": {
    "node": "^20.x"
  }
}

This are my modules in the nuxt.config.ts

extends: ['@shopware-pwa/composables-next/nuxt-layer'],

  modules: [
    'nuxt3-leaflet',
    '@vueuse/nuxt',
    '@shopware-pwa/nuxt3-module',
    '@shopware-pwa/cms-base',
    '@nuxtjs/google-fonts',
    '@nuxtjs/tailwindcss',
    '@nuxtjs/i18n',
    'nuxt-lazy-load',
    'nuxt-security',
    '@zadigetvoltaire/nuxt-gtm',
    '@zoom-avant/nuxt',
    'nuxt-svgo',
    '@nuxt/image',
    '@nuxt/eslint',
  ],

when I start my server with pnpm dev, I get the following error:

 ERROR  Error while requiring module [object Object]: Error: Cannot find module '@shopware-pwa/cms-base/module'                                      17:03:11  
Require stack:
- C:\Users\developer\development\nuxt\SN.Shopware.Headless\index.js

 ERROR  Cannot start nuxt:  Cannot find module '@shopware-pwa/cms-base/module'                                                                       17:03:11  
Require stack:
- C:\Users\developer\development\nuxt\SN.Shopware.Headless\index.js

I tried deleting and reinstalling the lock file, pnpm nuxi cleanup, reinstalling node_modules etc, but unfortunately I have continuously this error

Expected Behavior

No error when starting the Nuxt app

Steps To Reproduce

  1. Install the latest @shopware-pwa/cms-base and Nuxt version
  2. Add it to the modules section of the nuxt config
  3. Try to start the server

Environment

Anything else?

Thank you and kind regards

patzick commented 2 days ago

hey @lionel-addvanto cms-base is not working as a module, but it's a nuxt layer, so it should be in `thenuxt.config.ts`

extends: [
    "@shopware-pwa/composables-next/nuxt-layer",
    "@shopware-pwa/cms-base",
  ],

and not in modules. Additionally @shopware-pwa/shopware-6-client - this package should no longer be there, it's removed and replaced by the @shopware/api-client package.

Let me know if you'll have further problems so I'll reopen it 🙌

lionel-addvanto commented 2 days ago

Thank you @patzick, it works fine now😊🙏

Maybe you could update the documentation for the package because there it is explained different🤔 https://github.com/shopware/frontends/tree/main/packages/cms-base#setup

patzick commented 2 days ago

Good point, will do!