Server Side Rendering Error: Error [ERR_REQUIRE_ESM]: require() of ES Module
See original GitHub issueEnvironment
- Operating System:
Windows_NT - Node Version:
v16.10.0 - Nuxt Version:
2.16.0-27226092.034b9901 - Package Manager:
npm - Bundler:
Webpack - User Config:
buildModules - Runtime Modules:
- - Build Modules:
@nuxt/bridge@3.0.0-27235989.d52b1e8
Describe the bug
When i try to run my Nuxt 2 project with Nuxt Bridge it doesnโt work. I tried to remove all unnecessary stuff but I still get the same error on run
Server Side Rendering Error: Error [ERR_REQUIRE_ESM]: require() of ES Module D:\projects\nuxt3Test\node_modules\node-fetch\sr
c\index.js from D:\projects\nuxt3Test\.nuxt\dist\server\server.js not supported.
Instead change the require of index.js in D:\projects\nuxt3Test\.nuxt\dist\server\server.js to a dynamic import() which is av
ailable in all CommonJS modules.
Whole code to reproduce the error is here https://github.com/PayteR/Nuxt3Test
When I tried to install fresh Nuxt 2 and then add Bridge, then it runs all good.
Reproduction
Download code from here https://github.com/PayteR/Nuxt3Test install dependencies and run
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:11 (3 by maintainers)
Top Results From Across the Web
require() of ES Module while using SSR (Inertiajs) - Stack ...
But just while running the final node process ( node public/js/ssr.js ), I'm getting this error: Error [ERR_REQUIRE_ESM]: require() of ES Moduleย ...
Read more >Error: Must use import to load ES Module ยท Issue #25454
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\test-nextjs\.next\server\pages\_document.js require() of ES modules is notย ...
Read more >How to Bypass ES Modules Errors in Next.js with Dynamic ...
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /path/to/package require() of ES modules is not supported. ES module file as itย ...
Read more >Server-side rendering (SSR) with Angular Universal
The route comes from the client's request to the server. Each request results in the appropriate view for the requested route. The renderModule()...
Read more >Server Side Rendering Frameworks with @arcgis/core - Esri
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: โฆ require() of ES modules is not supported. โฆ is an ES module file...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I think i have a similar issue:
Iโm closing this as it seems resolved.
@Razunter Try running:
(If you drop the version tag off the end youโll get the error youโre seeing from yarn.)