Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sakit0 opened this issue Aug 29, 2021 · 5 comments
Labels

Comments

@sakit0
Copy link

sakit0 commented Aug 29, 2021

Describe the bug

I'm running into the same problem as this.
vercel/next.js#28319 (comment)

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.

@kirill-konshin
Copy link
Owner

Released 7.0.3

@sakit0
Copy link
Author

sakit0 commented Sep 3, 2021

@kirill-konshin Thanks!!

@KakakuCZ
Copy link

KakakuCZ commented Sep 8, 2021

Thank you, but it is not still working.
Next version: 11.1.2
Next-redux-wrapper version: 7.0.4

I have completely same error as author of this issue. The problem is next renamed next/dist/next-server/lib/utils to next/dist/server/lib/utils.

I hoped that 7.0.3 will fix this problem, but in es6/index.ts there is still import next/dist/next-server/lib/utils...

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>;

@kirill-konshin kirill-konshin reopened this Sep 8, 2021
@kirill-konshin
Copy link
Owner

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

kirill-konshin added a commit that referenced this issue Sep 13, 2021
@kirill-konshin
Copy link
Owner

Released 7.0.5

@sakit0 sakit0 closed this as completed Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants