shuding / nextra

Simple, powerful and flexible site generation framework with everything you love from Next.js.
https://nextra.site
MIT License
11.28k stars 1.24k forks source link

Could not find a declaration file for module 'nextra'. implicitly has an 'any' type #2948

Open sarkaramitabh300 opened 2 months ago

sarkaramitabh300 commented 2 months ago

I am facing this typescript issue, which is creating problem while deploying on vercel.

Could not find a declaration file for module 'nextra'. '//nettools/node_modules/nextra/dist/index.js' implicitly has an 'any' type. There are types at '//node_modules/nextra/dist/types.d.mts', but this result could not be resolved when respecting package.json "exports". The 'nextra' library may need to update its package.json or typings.

andrii-bodnar commented 2 months ago

What version of Nextra are you using? Please share more details about your setup or create a minimal reproducible example.

LuchoTurtle commented 2 months ago

@andrii-bodnar I'm getting this exact same error, though my Nextra project, albeit small (I'm just writing a small tutorial for myself and documenting my process), needed to have authentication.

For this to happen, I quite literally used the same source code from nextra-docs-theme and put it under a theme directory and changed next.config.js so it uses this "custom" theme.

When I run pnpm run build, I have this exact error that @sarkaramitabh300 is having.

You can find the PR of my project at https://github.com/dwyl/nextra-demo/pull/2, so there's an example to check out, if you want. I made some modifications to the original theme, where I wrote inside the theme/README.md file, though they are just minor adjustments to how Tailwind is imported, so nothing biggie.

I think it may be an issue with pnpm workspaces but I would really appreciate your help here :D

Syntarex commented 1 month ago

Same issue here. :(

cjlawson02 commented 2 weeks ago

Changing my tsconfig.json to have moduleResolution: "node" instead of "bundler" fixed this for me