kevinmarrec/nuxt-pwa-module

ERROR Cannot restart nuxt: The requested module '@nuxt/kit' does not provide an export named 'addImportsDir'

devloperabhishek opened this issue · 4 comments

Getting below error:

ERROR Error while requiring module @kevinmarrec/nuxt-pwa: SyntaxError: The requested module '@nuxt/kit' does not provide an export named 'addImportsDir'

ERROR Cannot restart nuxt: The requested module '@nuxt/kit' does not provide an export named 'addImportsDir' 16:25:12

import { useNuxt, addTemplate, addServerHandler, defineNuxtModule, createResolver, addImportsDir } from '@nuxt/kit';
^^^^^^^^^^^^^
SyntaxError: The requested module '@nuxt/kit' does not provide an export named 'addImportsDir'
at ModuleJob._instantiate (internal/modules/esm/module_job.js:124:21)
at async ModuleJob.run (internal/modules/esm/module_job.js:179:5)
at async Loader.import (internal/modules/esm/loader.js:178:24)
at async normalizeModule (node_modules/nuxt/node_modules/@nuxt/kit/dist/index.mjs:432:28)
at async installModule (node_modules/nuxt/node_modules/@nuxt/kit/dist/index.mjs:415:41)
at async initNuxt (node_modules/nuxt/dist/index.mjs:1825:7)
at async load (node_modules/nuxi/dist/chunks/dev.mjs:6779:9)
at async Object.invoke (node_modules/nuxi/dist/chunks/dev.mjs:6840:5)
at async _main (node_modules/nuxi/dist/cli.mjs:50:20)

Screenshot 2023-01-19 at 4 36 25 PM

after following steps:

  1. npm install -D @kevinmarrec/nuxt-pwa
  2. Edit my nuxt.config.ts file to add PWA module :
    modules: [
    '@kevinmarrec/nuxt-pwa'
    ]
amery commented

I have similar problems witth a different nuxt plugin. somehow Vue loses its TransitionProps declaration. I think it's caused by over-aggressive tree shaking but I have no idea how to deal with it

@amery this sounds like a totally different problem

@devloperabhishek Please share a reproduction on e.g. stackblitz and ensure you use Nuxt 3.0.0

@devloperabhishek Please follow @manniL comment regarding Nuxt version & sharing a reproduction.

It was most probably an issue regarding other @nuxt/kit installed version over nuxt framework @nuxt/kit one.

Evertyhing should work if you're simply using latest Nuxt (at least ^3.0.0).

Closing as stale issue.