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.

Cannot find 'node-fetch-native/dist/polyfill.mjs' with production build

See original GitHub issue

Environment

Nuxi 3.0.0-rc.12-27729267.0640a6c


  • Operating System: Darwin
  • Node Version: v16.14.2
  • Nuxt Version: 3.0.0-rc.12-27729267.0640a6c
  • Nitro Version: 0.5.4-27726613.640c2b7
  • Package Manager: pnpm@7.9.0
  • Builder: vite
  • User Config: ssr, app, css, buildModules, build, nitro, runtimeConfig
  • Runtime Modules: -
  • Build Modules: nuxt-windicss@2.5.1

Reproduction

I can provide a reproduction if required … but this seems to be happening on both rc-11, rc-12 and latest …

Describe the bug

After running pnpm run build on my project, I am seeing the following stack trace when starting the node server (either using node ./server/index.mjs or pnpm preview) …

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/michael/Developer/observerly/sirius/apps/www/.output/server/node_modules/node-fetch-native/dist/polyfill.mjs' imported from /Users/michael/Developer/observerly/sirius/apps/www/.output/server/index.mjs
    at new NodeError (node:internal/errors:371:5)
    at finalizeResolution (node:internal/modules/esm/resolve:418:11)
    at moduleResolve (node:internal/modules/esm/resolve:983:10)
    at defaultResolve (node:internal/modules/esm/resolve:1080:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:79:40)
    at link (node:internal/modules/esm/module_job:78:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Additional context

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
smakhtincommented, Sep 26, 2022

For me it helped to remove yarn.lock and generate new one from scratch.

2reactions
danielroecommented, Sep 23, 2022

Here’s a minimal reproduction: https://stackblitz.com/edit/github-1nqt6s.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using node-fetch in React app - "Cannot find module 'node:http'"
export default App; Then I try compiling or running the project and I get the following error message: . \node_modules\node-fetch\src\index.
Read more >
node-fetch - npm
A light-weight module that brings Fetch API to node.js. Latest version: 3.3.0, last published: a month ago. Start using node-fetch in your ...
Read more >
Node.js: this is how the new Fetch API works - Rootstack
How to use Fetch in Node.js framework. The Fetch API is a high-level function and takes a URL to produce a promise that...
Read more >
Fetch find - Hutton
FetchFind Essentials Expert-backed pet care education and access to ... Cannot find 'node-fetch-native/dist/polyfill.mjs' with production build #7729.
Read more >
Fetch API has landed into Node.js - Hacker News
You could agree on server-specific extensions to fetch and codify them in the same spec (so it doesn't get lost otherwise). Browser vendors...
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