Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Getting typescript error "module '@nuxt/schema' cannot be found" when extending layer template #22701

@DawidKopys

Description

@DawidKopys

Environment

app:

- Operating System: `Darwin`
- Node Version:     `v18.16.0`
- Nuxt Version:     `3.6.5`
- Nitro Version:    `2.5.2`
- Package Manager:  `[email protected]`
- Builder:          `vite`
- User Config:      `extends`, `typescript`, `devtools`
- Runtime Modules:  `-`
- Build Modules:    `-`

nuxt-layer:

- Operating System: `Darwin`
- Node Version:     `v18.16.0`
- Nuxt Version:     `3.6.5`
- Nitro Version:    `2.5.2`
- Package Manager:  `[email protected]`
- Builder:          `vite`
- User Config:      `typescript`
- Runtime Modules:  `-`
- Build Modules:    `-`

Reproduction

  1. clone repo https://github.com/DawidKopys/nuxt-schema-error-repro
  2. run npm i in nuxt-layer directory
  3. run npm i in app directory
  4. run npx nuxi typecheck / npm run dev / npx vue-tsc --noEmit inside app directory. You should get below error:
../nuxt-layer/app.config.ts:7:16 - error TS2664: Invalid module name in augmentation, module '@nuxt/schema' cannot be found.

7 declare module '@nuxt/schema' {
                 ~~~~~~~~~~~~~~


Found 1 error in ../nuxt-layer/app.config.ts:7

Describe the bug

  • the app directory was created by running npx nuxi@latest init app from the docs
  • the nuxt-layer directory was created with nuxt layer template - by running npx nuxi init --template layer nuxt-layer command from the docs
  • type checking was enabled in both directories by simply running npm install --save-dev typescript vue-tsc and turning type checking inside nuxt.config.ts for both directories

So, basically, I have just used the starters for app and layer, turned type checking for them, and I am getting this ts error straight away.

This error is very confusing to me as using @nuxt/schema was a solution to my previous (similar) issue and it works just fine if I use it in the repo linked in the issue - https://github.com/DawidKopys/nuxt-layers. But for some reason it doesn't work in above simple setup.

Additional context

Using @nuxt/schema was a solution to my previous (similar) issue and it works just fine if I use it in the repo linked in the issue - https://github.com/DawidKopys/nuxt-layers. But for some reason it doesn't work in above simple setup.

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions