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.

Error: Cannot find module "server.mjs"

See original GitHub issue

Environment


  • Operating System: Linux
  • Node Version: v14.19.1
  • Nuxt Version: 2.16.0-27358576.777a4b7f
  • Package Manager: npm@8.6.0
  • Builder: webpack
  • User Config: rootDir, bridge, telemetry, nitro, head, css, plugins, components, buildModules, modules, compilerOptions, build, watchers, ssr
  • Runtime Modules: -
  • Build Modules: @nuxt/bridge@3.0.0-27495135.4d1a6ba

Reproduction

Describe the bug

Since a recent update I cannot get Nuxt to work anymore. The application builds without errors, but when loading the page I get the 500 status with the error.

The error in the terminal is this:

✔ Builder initialized                                                                                                                                                                                  09:18:46
✔ Nuxt files generated                                                                                                                                                                                 09:18:46

✔ Client
  Compiled successfully in 3.12s

✔ Nitro built in 269 ms                                                                                                                                                                          nitro 09:18:50
ℹ Waiting for file changes                                                                                                                                                                             09:18:50
[nitro] [request error] Cannot find module '/home/haaiee/Projects/Docker/nuxt-bridge-error-demo/.nuxt/dist/server/server.mjs' imported from /home/haaiee/Projects/Docker/nuxt-bridge-error-demo/.nuxt/dev/index.mjs
  at new NodeError (internal/errors.js:322:7)  
  at finalizeResolution (internal/modules/esm/resolve.js:318:11)  
  at moduleResolve (internal/modules/esm/resolve.js:776:10)  
  at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:887:11)  
  at Loader.resolve (internal/modules/esm/loader.js:89:40)  
  at Loader.getModuleJob (internal/modules/esm/loader.js:242:28)  
  at Loader.import (internal/modules/esm/loader.js:177:28)  
  at importModuleDynamically (internal/modules/esm/translators.js:114:35)  
  at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:30:14)  
  at ./.nuxt/dev/index.mjs:371:66

Additional context

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
HendrikJancommented, Apr 12, 2022

@danielroe The other issue (#886) is for “build”. This issue is when running “nuxi dev”.

0reactions
Eckhardt-Dcommented, Apr 13, 2022

Same issue here with server.mjs not found migrating fresh Nuxt2 project with bridge. Note, this is only happening if ssr: false.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error [ERR_MODULE_NOT_FOUND]: Cannot find module
This answer was the one that helped me! I was using import and the file was .js - Adding --es-module-specifier-resolution=node saved the day...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
Why the "Error: cannot find module" Occurs. This error occurs because of the following reasons: you're trying to import an item from a ......
Read more >
[Solution] Error: Cannot Find Module "nodemailer" - Courier
This error occurs when you have not installed the nodemailer library in your Node.js application. Solution - Here's How To Resolve It. First,...
Read more >
module not found issue - Google Groups
Hi,. I just hosted my nodejs app on aws and got this weird error, I rechecked the files multiple times the file is...
Read more >
Fix error: cannot find module 'x' in Node.js or 'express'
A quick fix to the error-cannot find module is to try and install all the presented module in your terminal correctly. Navigate to...
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