'inAmpMode' of '(0 , _react).useContext(...)' as it is null. #30602
Replies: 22 comments 24 replies
-
same problem here, any updates? |
Beta Was this translation helpful? Give feedback.
-
Package manager : Yarn v3.1.0 I am facing same issue. Tried removing yarn.lock and reinstalling but issue remains. The only solution i found was to change nodeLinker to node_modules |
Beta Was this translation helpful? Give feedback.
-
got this error when accidentally turned on transpiling of next/dist |
Beta Was this translation helpful? Give feedback.
-
We are seeing this issue currently. Would it make sense to convert this to an Issue? I wonder if others are encountering it, as well. |
Beta Was this translation helpful? Give feedback.
-
Same here, just ran into this trying to upgrade from v10 to v11 ... any insights in how to resolve it would be great (tried all of the above. Also sidenote, it seems to happen only running dev mode, the build passes fine and the page renders/works after that 😕 |
Beta Was this translation helpful? Give feedback.
-
I just downgraded from 12.0.7 to 12.0.4 and the error seemed to go away. I was experiencing this running next build, next dev was working just fine. Hope tha thelps! |
Beta Was this translation helpful? Give feedback.
-
People still having the issue: Do you have a custom |
Beta Was this translation helpful? Give feedback.
-
In my case upgrading of the plugin next-transpile-modules to the compatible version solved the problem |
Beta Was this translation helpful? Give feedback.
-
I'm seeing the same issue on Next 12.0.4.
I've noticed this only happens for pages where I have a |
Beta Was this translation helpful? Give feedback.
-
This happened to me when I used |
Beta Was this translation helpful? Give feedback.
-
This happened to me when I used Html tag --------> { Html } from 'next/document'; |
Beta Was this translation helpful? Give feedback.
-
I had this issue when I added const withTM = require("next-transpile-modules")([
"pdfobject",
"next-pwa",
- "next",
]); |
Beta Was this translation helpful? Give feedback.
-
This issue is probably related to your project has multiple next.js installed. In my case, I separate next server to an independent package, and use pnpm as package manager. So there is two next.js in my project (they are soft linked to root node_modules)
so multiple instance of HtmlContext exits, then the solutionIn server's code, |
Beta Was this translation helpful? Give feedback.
-
maybe this documentation can help if you need to use Html component, in my case I need to put some props to Html tag, I tried to put Html component on my index page and ended up with this error, after following the docs everything seems fine 🎉 |
Beta Was this translation helpful? Give feedback.
-
Issue happened to me when I imported Head from 'next/document' instead of 'next/head' I'd love if the code actually tells you whats wrong |
Beta Was this translation helpful? Give feedback.
-
Finally solved it, tho I don't fully understand it. (none of above worked for me, tho they helped) (next: 12.3.1, next-transpile-modules 9.1.0) TLDR: in monorepo (yarn) -> make sure 'next' is a dependency of the root package.json and 'only' peerDependency of package that uses it I am using monorepo (yarn workspaces) I use transpile modules as my sub-modules are written in typescript I had I modified it to make It started to work, but I wanted to understand why. (spoiler: only partially understood it) I found out that If If it was peer dep and dep of ROOT - it was shorter. Both versions included something like: /***/ }),
/***/ "./node_modules/next/dist/pages/_document.js":
/*!***************************************************!*\
!*** ./node_modules/next/dist/pages/_document.js ***!
\***************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
eval("\nObject.defineProperty So as I don't fully understand it - here is my take: For some transpiling reason, import dependency tree was different - resulting in duplicates of modules in What I also did during debugging was adding console.log at root level of Tricky part about this error is that error message is extremely confusing. Hope it helps someone. |
Beta Was this translation helpful? Give feedback.
-
Received this error when upgrading from |
Beta Was this translation helpful? Give feedback.
-
The Main tag is an example of a multi-instance in which one should be careful with the letter casing. The solution here is removing the Main importation and changing the tag Main to lowercase main |
Beta Was this translation helpful? Give feedback.
-
For me, I received the |
Beta Was this translation helpful? Give feedback.
-
I switched from yarn to npm . it solved it for me |
Beta Was this translation helpful? Give feedback.
-
Monorepo with docker / yarn v1 / lerna v4 here. I had to remove all |
Beta Was this translation helpful? Give feedback.
-
For npm users, I ran: |
Beta Was this translation helpful? Give feedback.
-
After migrate nextjs 12 I got error when run project.
I don't know why this error occured .... 😭
Beta Was this translation helpful? Give feedback.
All reactions