You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Error: cannot find module 'stream'" when using Chrome #477
On my Windows Home desktop, I install jszip 3.1.4 with NPM and open this html file with Google Chrome browser (Version 61.0.3163.100 (Official Build) (64-bit)):
Problem does not occur with Firefox, MS IE, or MS Edge.
Similar to what @mitchwilson found in Issue #464, when I comment out line #1709 module.exports = require("stream"); it works fine. I'm using jszip on client side.
Hi David, yes, the issue is still there with Chrome 62.0.3202.89 (Official
Build).
However, I'm running 64-bit Windows 10 version 1703 (OS Build 15063.674).
I haven't tried it on other computers yet. But my wife's and son's
computers are also Windows 10.
I'm just a retired software engineer / hobbyist, so no need to make it a
priority.
Thanks,
On Wed, Nov 8, 2017 at 5:44 PM, David Duponchel ***@***.***> wrote:
I can't reproduce the issue in my VM (windows 7, Chrome Version
62.0.3202.89 (Official Build) (32-bit)), I get no error in the console.
Do you still have the issue in chrome 62 ? Does it happens on an other
computer ?
I can exclude the require('stream'); from the generated file but I would
like to understand the cause of the issue here before anything else.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#477 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/Af0MBLgkBsf6RJ-oAfmvfAEpO6zRUhsoks5s0jzPgaJpZM4QRwCa>
.
I should have access to 64-bit Windows 10 this weekend, I'll try again then.
Do you use a "vanilla" chrome or do you have extensions ? In the latter case, does it still happens if you disable them ?
no need to make it a priority
You have maybe found a serious issue (JSZip not loading at all in chrome). Also, your report is clear, with enough details, show research effort and has a minimalist test case (thank you !). More than enough to be motivated !
On Thu, Nov 9, 2017 at 6:49 PM, David Duponchel ***@***.***> wrote:
I should have access to 64-bit Windows 10 this weekend, I'll try again
then.
Do you use a "vanilla" chrome or do you have extensions ? In the latter
case, does it still happens if you disable them ?
no need to make it a priority
You have maybe found a serious issue (JSZip not loading at all in chrome).
Also, your report is clear, with enough details, show research effort and
has a minimalist test case (thank you !). More than enough to be motivated !
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#477 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/Af0MBAVWI8CJpF6z9EdRgspBMGppnWMpks5s052wgaJpZM4QRwCa>
.
Is there any updates to this?
I got this problem when updating my Angular app from 5.2 to 6. And angular cli, which now uses Webpack 4. Typesript also updated from 2.6.2 -> 2.7.2.
What's happening, at least for me, is that just loading the .min.js file directly into a web browser from a CDN doesn't work because require doesn't exist. At least as far as I can understand the minified code:
Installing requirejs works around the immediate problem. I don't know what's happening for the offline builder people but I do find myself wondering if the other package systems expose node-style require.
As a plea: some of us can't use offline builders; having a demoduled version would be awesome...
Edit: installing requirejs doesn't solve the immediate problem. It doesn't crash on load any more, but the module never gets installed.
Edit edit: no, that's not quite it. The minified Javascript provides its own require, but the error's because it's trying to call the system one. For some reason it hasn't found the version of stream defined in the jszip code.
readable-stream depends on stream. stream is not in the bundle, so it falls back on a call to external require(). If this doesn't exist an error is logged and an exception thrown. But in jszip, the exception is then caught above and no harm is done, except for the misleading error.
Something else was going wrong in my code, which was causing the jszip symbol not to be inserted into the environment, so I thought it wasn't loading properly even though it was. (Because Javascript browser-side error handling...)
I do see one other call to readable-stream, somewhere to do withNodejsStreamOutputAdapter, but I'm guessing that as I can successfully generate zipfiles I don't need it. We'll see.
Activity
dduponchel commentedon Nov 8, 2017
I can't reproduce the issue in my VM (windows 7, Chrome Version 62.0.3202.89 (Official Build) (32-bit)), I get no error in the console.
Do you still have the issue in chrome 62 ? Does it happens on an other computer ?
I can exclude the
require('stream');from the generated file but I would like to understand the cause of the issue here before anything else.dave-hirschman commentedon Nov 9, 2017
dduponchel commentedon Nov 10, 2017
I should have access to 64-bit Windows 10 this weekend, I'll try again then.
Do you use a "vanilla" chrome or do you have extensions ? In the latter case, does it still happens if you disable them ?
You have maybe found a serious issue (JSZip not loading at all in chrome). Also, your report is clear, with enough details, show research effort and has a minimalist test case (thank you !). More than enough to be motivated !
dave-hirschman commentedon Nov 10, 2017
dduponchel commentedon Nov 12, 2017
I tried on a 64-bit Windows 10 (chrome 62), still no issue.
I prepared a possible fix (2c93455), could you try with this file: https://github.com/dduponchel/jszip/blob/issue477/dist/jszip.js ?
dave-hirschman commentedon Nov 13, 2017
anthonn commentedon May 10, 2018
Hi,
Is there any updates to this?
I got this problem when updating my Angular app from 5.2 to 6. And angular cli, which now uses Webpack 4. Typesript also updated from 2.6.2 -> 2.7.2.
marlon360 commentedon May 12, 2018
Same problem like @AnthonNilsson.
After updating to Angular 6 I got this error when compiling:
anthonn commentedon May 13, 2018
I could get around the problem by installing "stream" as one of my npm packages manually.
davidgiven commentedon Mar 27, 2019
I'm getting this too.
What's happening, at least for me, is that just loading the .min.js file directly into a web browser from a CDN doesn't work because
requiredoesn't exist. At least as far as I can understand the minified code:Installing requirejs works around the immediate problem. I don't know what's happening for the offline builder people but I do find myself wondering if the other package systems expose node-style
require.As a plea: some of us can't use offline builders; having a demoduled version would be awesome...
Edit: installing requirejs doesn't solve the immediate problem. It doesn't crash on load any more, but the module never gets installed.
Edit edit: no, that's not quite it. The minified Javascript provides its own
require, but the error's because it's trying to call the system one. For some reason it hasn't found the version ofstreamdefined in the jszip code.Yeah, I have no idea what's going on here.
davidgiven commentedon Mar 28, 2019
Aha, got it!
This is, in fact, a complete red herring. The code works fine (so far, for me),
What appears to be happening is that it's doing this:
readable-streamdepends onstream.streamis not in the bundle, so it falls back on a call to externalrequire(). If this doesn't exist an error is logged and an exception thrown. But in jszip, the exception is then caught above and no harm is done, except for the misleading error.Something else was going wrong in my code, which was causing the jszip symbol not to be inserted into the environment, so I thought it wasn't loading properly even though it was. (Because Javascript browser-side error handling...)
I do see one other call to
readable-stream, somewhere to do withNodejsStreamOutputAdapter, but I'm guessing that as I can successfully generate zipfiles I don't need it. We'll see.But I think this is just cosmetic.
Fix browser module resolution