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.

The requested module does not provide an export named 'PassThrough'

See original GitHub issue

Calling fetch gives me the following error

node_modules/node-fetch/lib/index.mjs:1
import Stream, { PassThrough } from 'stream';
                 ^^^^^^^^^^^
SyntaxError: The requested module does not provide an export named 'PassThrough'

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:14
  • Comments:15

github_iconTop GitHub Comments

4reactions
jaydensericcommented, Oct 11, 2018

The published ESM in lib/index.mjs contains this line:

import Stream, { PassThrough } from 'stream'

Turns out, PassThrough is not a named export of stream in Node.js v8, but it is in v10:

// test.mjs
import { PassThrough } from 'stream'
node --experimental-modules test

In Node.js v8.12.0:

$ node --experimental-modules test
(node:32448) ExperimentalWarning: The ESM module loader is experimental.
SyntaxError: The requested module does not provide an export named 'PassThrough'
    at ModuleJob._instantiate (internal/loader/ModuleJob.js:85:17)
    at <anonymous>

In Node.js v10.11.0:

$ node --experimental-modules test
(node:32605) ExperimentalWarning: The ESM module loader is experimental.
0reactions
joakimsandstromfinnaircommented, Nov 8, 2018

also works for me, thx for the fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Requested module does not provide export named 'default'
To solve the error "The requested module does not provide an export named default", use the `default` keyword when exporting a value from...
Read more >
the requested module does not provide an export named
The reason it didn't work is that Vue provides a named export, whereas you are trying to import it as though it had...
Read more >
"The requested module ' does not provide an export named ...
I have no control over how the api module is built. How can it work in one case but not another? This is...
Read more >
lstm example with node.js, load, and http requests
I had it running in the browser so that it would load a pre-trained model from ... The requested module does not provide...
Read more >
Import-Module (Microsoft.PowerShell.Core)
Starting in PowerShell 3.0, installed modules are automatically imported to ... PassThru, or AsCustomObject parameter, Import-Module does not generate any ...
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