question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find module 'next/dist/next-server/lib/utils' or its corresponding type declarations.

See original GitHub issue

Describe the bug

I’m running into the same problem as this. https://github.com/vercel/next.js/issues/28319#issuecomment-902699740

This happens when I do a Next build.

  • Version
  • Next 11.1.0
  • next-redux-wrapper 7.0.2
../node_modules/next-redux-wrapper/es6/index.d.ts:30:111
Type error: Cannot find module 'next/dist/next-server/lib/utils' or its corresponding type declarations.

  28 |     getServerSideProps: <P extends {} = any>(callback: GetServerSidePropsCallback<S, P>) => GetServerSideProps<P, import("querystring").ParsedUrlQuery>;
  29 |     getStaticProps: <P_1 extends {} = any>(callback: GetStaticPropsCallback<S, P_1>) => GetStaticProps<P_1, import("querystring").ParsedUrlQuery>;
> 30 |     getInitialAppProps: <P_2 extends {} = any>(callback: AppCallback<S, P_2>) => ({ Component, ctx, }: import("next/dist/next-server/lib/utils").AppContextType<import("next/dist/client/router").Router>) => Promise<import("next/app").AppInitialProps>;
     |                                                                                                               ^
  31 |     getInitialPageProps: <P_3 extends {} = any>(callback: PageCallback<S, P_3>) => ((context: NextPageContext<any>) => any) | undefined;
  32 |     withRedux: (Component: NextComponentType | App | any) => {
  33 |         new (props: any, context: any): {

Nex.tjs answers.

You’ll have to report this to https://github.com/kirill-konshin/next-redux-wrapper as it’s using Next.js internals which can change at any time. Anything in next/dist should not be imported.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
kirill-konshincommented, Sep 1, 2021

Released 7.0.3

1reaction
kirill-konshincommented, Sep 8, 2021

This is what TypeScript is producing… I will try to fix it differently.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module 'next/dist/next-server/lib/utils' or ... - GitHub
ts:30:111 Type error: Cannot find module 'next/dist/next-server/lib/utils' or its corresponding type declarations. 28 | getServerSideProps: <P ...
Read more >
Cannot find module 'next' or its corresponding type declarations
In Yarn 2/3, support for modules in the node_modules folder is removed because of PnP. Follow the steps below to resolve the issue....
Read more >
Cannot find module 'X' Error in TypeScript | bobbyhadz
The "Cannot find module or its corresponding type declarations" error occurs when TypeScript cannot locate a third-party or local module in our project....
Read more >
module-not-found - Next.js
A module not found error can occur for many different reasons: The module you're trying to import is not installed in your dependencies;...
Read more >
next-optimized-images - Bountysource
Type error: Cannot find module '../public/images/socialImage.png' or its corresponding type declarations. 10 \| // Custom 11 \| import ".
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found