nuxt / nuxt

The Intuitive Vue Framework.
https://nuxt.com
MIT License
54.97k stars 5.03k forks source link

nuxt3.4.1 Object literal may only specify known properties, and 'srcDir' does not exist in type 'NuxtConfig'. #20302

Closed stephenjason89 closed 1 year ago

stephenjason89 commented 1 year ago

Environment


Reproduction

https://github.com/stephenjason89/nuxt-vuetify-graphql-pinia-starter Clone the project then pnpm i pnpm dev

open file nuxt.config.ts no errors yet. on nuxt 3.3.2

nuxt upgrade --force then pnpm dev

check nuxt.config.ts

image

error on nuxt 3.4.1

Describe the bug

 Object literal may only specify known properties, and 'srcDir' does not exist in type 'NuxtConfig'.

Additional context

No response

Logs

No response

danielroe commented 1 year ago

I can't reproduce this with those exact steps. Any chance you have an extra folder, like a dist or .output or something else gitignored? Or do you have a node_modules folder in a parent directory that might be getting pulled in?

CleanShot 2023-04-16 at 15 11 53@2x
stephenjason89 commented 1 year ago

@danielroe Have you tried nuxt upgrade --force on the project that i linked? The project is currently at nuxt 3.3.2 and no linting errors for me there as well. Upgrading to 3.4.1 causes the error for me

I do have dist and .output gitignored https://github.com/stephenjason89/nuxt-vuetify-graphql-pinia-starter/blob/main/.gitignore But this doesn't cause the issue on 3.3.2

After commenting out dist and .output on my gitignore and trying it out at 3.4.1

image image

Error is still is present

image

Please let me know if after upgrading to 3.4.1 you still don't get the error. And maybe some possible things i can do to debug this? Thank you in advance

danielroe commented 1 year ago

Yes, I did indeed run that command and could not reproduce the issue.

Adding or removing paths to .gitignore won't make any difference. Would you try deleting them, and rerunning nuxi prepare, and then restart your IDE to see if it helps?

krissss commented 1 year ago

Perhaps it's a problem with webstorm. There's no problem with vscode.

stephenjason89 commented 1 year ago

Thank you for the reply @danielroe i deleted dist and .output did nuxi prepare and restarted my IDE

image

@krissss I am getting the same error on my vscode

image

I also tried deleting .nuxt & node_modules pnpm i nuxi prepare restart IDE But the error is still present

Please let me know what other steps i can do to debug this. Thank you so much

noyalin commented 1 year ago

I have encountered the same problem and I don't know what to do.

danielroe commented 1 year ago

The best thing is if you can provide a reproduction. Please check first that you can reproduce by following the exact steps in the reproduction (including cloning fresh).

stephenjason89 commented 1 year ago

@danielroe will try it on a different computer. I have tried cloning fresh and can reproduce it in the same computer. Might have something to do with my environment.

Will report back once I have tried reproducing it in a different computer.

alimozdemir commented 1 year ago

It is very hard to create a reproduction repository when you have a large repo. There are too many variables.

I have the same issue but what I found is actually very interesting @danielroe

image

I just removed that extends configuration and the error moves to the 'nitro' configuration. Then If I remove the nitro configuration error will be present in "experimental". So it goes like that,

What I understand from this point NuxtConfig interface is generated automatically and when I see the definition there is no configuration def for those things.

image

I think it misses some "extends BaseNuxtConfig" but idk.

I can share what packages I use.

"@nuxt/image-edge": "1.0.0-28020728.5df24eb",
"nuxt-simple-sitemap": "^2.4.11",

Node: v18 LTS

TomasSestak commented 1 year ago

same happening with buildModules

jeebeys commented 1 year ago

upgrading to TypeScript 5.0.4 resolved the problem for me :) #20221

elizabthpazp commented 1 year ago

I have the same problem

TheParad0X commented 1 year ago

Same probleme here. Adding typescript and vue-tsc to the devDevependencies solves the problem:


"devDependencies": {
    "typescript": "5.0.4",
    "vue-tsc": "1.6.4"
  },```
danielroe commented 1 year ago

Let's track in https://github.com/nuxt/nuxt/issues/20221.

stephenjason89 commented 1 year ago

Hey @danielroe , I can confirm that this did the trick https://github.com/nuxt/nuxt/issues/20221#issuecomment-1505323984 However, it introduced another bug.

image

this is not present with the bundled typescript compiler 4.8.4 and present in 5.0.4