"Error: The _read() method is not implemented" when used in the browser

See original GitHub issue

I’m unable to run tape in the browser with a simple bundle via Parcel. I receive this error at the first test:

VM30:1 Uncaught Error: The _read() method is not implemented
    at new o (<anonymous>:8:6099)
    at x.i.register.x._read (<anonymous>:1:10516)
    at x.i.register.x.read (<anonymous>:1:10218)
    at U (<anonymous>:1:8934)
    at x.<anonymous> (<anonymous>:1:11450)
    at x.i.register.a.emit (<anonymous>:1:19390)
    at x.s.resume (<anonymous>:1:3378)
    at x.To.r.resume (<anonymous>:8:84632)
    at x.i.register.x.on (<anonymous>:1:12975)
    at x.i.register.x.pipe (<anonymous>:1:11939)

Repro

  1. Create a test.js file:
import test from 'tape';

test('test using promises', t => {
  t.pass();
});
  1. Run these commands
echo '{}' > package.json
npm i tape parcel
npx parcel build test.js
  1. Copy the content of dist/main.js and execute it in the browser, like in the console.

Screenshot

Screen Shot

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
fregantecommented, Sep 12, 2021

Yes, adding that line to node_modules/tape/package.json helps!

  • webpack 4: it now works out of the box, no config
  • webpack 5: the config is still required, but the resolve.fallback.fs = false can be left out.

I opened a specific issue regarding path and stream, since this issue was actually due to Parcel and unrelated to Tape (even though it could be avoided altogether with https://github.com/substack/tape/issues/564)

0reactions
ljharbcommented, Aug 31, 2021

Sure, and if there’s an easy way to fix it that doesn’t impose a cost on those using working bundlers, I’m all for it.

Can you give https://github.com/substack/tape/issues/561#issuecomment-909469015 a shot and confirm that will help?

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - _read() is not implemented on Readable stream
createReadStream() will create read stream with the _read() function has been auto implemented to push file data and end when end of file....
Read more >
Error 501 Not Implemented: how to fix it and main causes
When the Error 501 code is returned, it means that the method used to fulfill the request does not work or was not...
Read more >
How to Fix the HTTP 501 Not Implemented Error on Your Site
The HTTP 501 Not Implemented status code indicates that the server does not support the functionality required to fulfill the request.
Read more >
How to Fix Request Method 'POST' Not Supported - Hyperping
The Request Method' POST' Not Supported error is caused by a mismatch of the web browser configuration and the browser's URL format.
Read more >
X" on Jest + JSDOM for component unit tests - Raul Melo
In this post I explain how to fix "Not implemented" problems while using Jest + JSDOM for component unit test.
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