vite-pwa / nuxt

Zero-config PWA Plugin for Nuxt 3
https://vite-pwa-org.netlify.app/frameworks/nuxt
MIT License
453 stars 22 forks source link

Cannot find module '#pwa' or its corresponding type declarations. #123

Open brugomes opened 7 months ago

brugomes commented 7 months ago

I'm following the basic instructions to setup @vite-pwa/nuxt

pnpm add @vite-pwa/nuxt -D

// nuxt.config.ts
import { defineNuxtConfig } from 'nuxt/config'

export default defineNuxtConfig({
  modules: [
    '@vite-pwa/nuxt'
  ],
  pwa: {
    /* PWA options */
  }
})

And got this error.

image image

I also have tryed this and got the same error.

rm -Rf node_modules
rm -Rf dist
rm -Rf .nuxt
pnpm store prune
pnpm add @vite-pwa/nuxt -D --force  
snolan-ethika commented 5 months ago

@brugomes did you happen to fix this? Also seeing this error...

userquin commented 5 months ago

Error when adding the pwa module? Provide a minimal reproduction, all my tests can install the pwa module: check https://vite-pwa-org.netlify.app/guide/scaffolding.html , follow the prompts selecting Vue when asking for Framework then Nuxt.

Maybe you can try adding .npmrc file with shamefully-hoist=true (iirc only pnpm).

@snolan-ethika @brugomes

YunYouJun commented 1 month ago

My guess is that you used nuxt as monorepo and used your own tsconfig.json compilterOptions.paths, which overrides nuxt's default generated tsconfig paths setting (#pwa).