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

Module not found: Can't resolve 'next/dist/shared/lib/router-context' #97

Open
jaumamyfront-ender opened this issue Sep 3, 2024 · 0 comments

Comments

@jaumamyfront-ender
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

library next-translate-routes didnt work ,i got error like this ===>Module not found: Can't resolve 'next/dist/shared/lib/router-context'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/next-translate-routes/index.js
./pages/_app.tsx
Using external babel configuration from /Users/bogdan/Documents/work/landing/.babelrc.js
⨯ ./node_modules/next-translate-routes/react/withTranslateRoutes.js:38:1
Module not found: Can't resolve 'next/dist/shared/lib/router-context'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/next-translate-routes/index.js
./pages/_app.tsx
GET / 500 in 7289ms

Here is the diff that solved my problem:

diff --git a/node_modules/next-translate-routes/react/withTranslateRoutes.js b/node_modules/next-translate-routes/react/withTranslateRoutes.js
index f9d2804..e2cff27 100644
--- a/node_modules/next-translate-routes/react/withTranslateRoutes.js
+++ b/node_modules/next-translate-routes/react/withTranslateRoutes.js
@@ -35,7 +35,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
 };
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.withTranslateRoutes = void 0;
-var router_context_1 = require("next/dist/shared/lib/router-context");
+// var router_context_1 = require("next/dist/shared/lib/router-context");
+var router_context_1 = require("next/dist/shared/lib/router-context.shared-runtime");
 var router_1 = require("next/router");
 var react_1 = __importStar(require("react"));
 var ntrData_1 = require("../shared/ntrData");

This issue body was partially generated by patch-package.
Zrzut ekranu 2024-09-2 o 15 03 49 (2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant