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 module` error for Node-provided package

See original GitHub issue

- Do you want to request a feature or report a bug? bug

- What is the current behavior? build fails with error Cannot find module 'stream/package.json'

- If the current behavior is a bug, please provide the steps to reproduce.

- What is the expected behavior?

There should be no need to install a stream package because it is provided by Node: https://nodejs.org/api/stream.html#stream_stream

I’m not sure why it’s trying to find stream/package.json and failing since this is a built-in package

- Please mention your node.js, and operating system version.

Node 16. Linux

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
benmccanncommented, Nov 4, 2021

This is now working. Existing projects will need to “clear cache and deploy”

Thanks for all the help!!

1reaction
netlify-team-account-1commented, Oct 15, 2021

Did some more digging. This error happens when you’re using zip-it-and-ship-it’s dependency resolution mechanism, which uses the Node’s builtin process.binding("natives") to get a list of which dependencies are native (like fs or path or stream/web) and which are not (like react or is-even). Relying on process.binding("natives") means that it depends on whatever Node version is used to do the bundling. Since stream/web, which is used by your dependency fetch-blob, is a Node v16 feature, it rightfully fails (aws lambda, and by extension netlify functions, don’t yet support Node v16). What zip-it-and-ship-it doesn’t detect: fetch-blob accounted for that to happen, and has a fallback strategy. So it fails wrongfully.

You can unblock yourselves by using the esbuild bundler (which I see you already found out via https://github.com/sveltejs/kit/pull/2605). In your case @marovargovcik this has the additional upside of replacing the rollup bundling stage altogether, since esbuild does all the things rollup does for you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I resolve "Cannot find module" error using Node.js?
Using npm install installs the module into the current directory only (in a subdirectory called node_modules ). Is app.js located under ...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
I'm getting the error because I'm trying to import the freeCodeCamp icon from the react-icons package, which I don't have installed. import { ......
Read more >
How to resolve "Cannot find module" error in Node - Sabe.io
When you are working in Node, you will sometimes encounter the error Cannot find module 'module-name' with the error code MODULE_NOT_FOUND .
Read more >
[Solution] Error: Cannot Find Module "nodemailer" - Courier
What's Causing This Error? This error occurs when you have not installed the nodemailer library in your Node.js application.
Read more >
Aimesh node disconnecting - Spendy Market
Dec 22, 2021 · ASUS Lyra Trio (2-Pack) AC1750 Dual Band Mesh WiFi System ... In the main router under Network map the...
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