Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nodestream not supported with 3.3.0 + #663

Open
emps opened this issue Apr 16, 2020 · 14 comments
Open

nodestream not supported with 3.3.0 + #663

emps opened this issue Apr 16, 2020 · 14 comments

Comments

@emps
Copy link

emps commented Apr 16, 2020

as i use jszip@3.2.0 nodestream is working and is also supported with my angular 8/9
but as i update it to 3.3.0 nodestream become to false

@Stuk
Copy link
Owner

Stuk commented Apr 19, 2020

@mgechev as the author of the PR that went into 3.3.0 could you chime in here?

@mgechev
Copy link
Contributor

mgechev commented Apr 20, 2020

Hey @Stuk, I'm lacking context; not sure what does this mean. Steps for reproduction would definitely help.

@emps
Copy link
Author

emps commented May 2, 2020

just import in Angular Application and u will see that 3.2.0 has support for nodestream and 3.3.0 does not, if u cant do it by some reason let me know

@callmeguaishu
Copy link

got the same error. JSzip.generateNodeStream() works well with JSZip 3.2.0, but failed with JSZip 3.3.0 & 3.4.0, throw an error: 'Error: nodestream is not supported by this platform', same as 491

@callmeguaishu
Copy link

seems like readable-stream redirect to stream, may be some useful informiation here776

@emps
Copy link
Author

emps commented Jun 14, 2020

hope who broke it will fix it, i will keep 3.2.0 till then

@emps emps changed the title nodestream not supported with 3.3.0 nodestream not supported with 3.3.0 + Jul 1, 2020
@emaFusco
Copy link

emaFusco commented Aug 3, 2020

We are having the same issue ('Error: nodestream is not supported by this platform') and we are stuck to version 3.2 as well.
Is there any news about this?

@stuarta0
Copy link

stuarta0 commented Aug 11, 2020

Yeah PR #614 breaks our build too; webpack+electron. I'm using patch-package to revert the change to package.json to fix it for now.

@jthrilly
Copy link

Just to add that we are also experiencing this issue with Electron.

@mgechev
Copy link
Contributor

mgechev commented Aug 18, 2020

You can revert #614 to get the previous behavior. Looks like doing so will break #524, #521, #477.

@jthrilly
Copy link

jthrilly commented Aug 18, 2020

Sure, the workaround of patching the package.json does work, but I'm hoping we can come up with something more sustainable for Electron + webpack users. Seems like I found a fix, which is to use a resolve alias to force the node version of jszip to be bundled when targeting electron-renderer.

In your webpack config, add something like:

module.exports = {
  /// ... other config 
  alias: {
    jszip: require.resolve('jszip/lib/index.js'),
  }  
}

@stuarta0 - this will work for you.

The fundamental problem is that webpack with the electron-renderer target will use the browser field in package.json to bundle the browser version of the library. This in turn will cause any JSZip method that calls nodeStream() to throw this error.

On the surface this is perfectly logical - the nodeStream method isn't available in the browser, and the electron renderer is a modified chromium environment. However, node streams are available in an Electron renderer environment when nodeIntegration is enabled.

Not sure what can be done about the situation, short of better environment detection in the module itself, rather than using the browser property in package.json.

mcous added a commit to tracespace/tracespace that referenced this issue Oct 13, 2020
jszip>=3.3 breaks if you use readable-stream in the browser via webpack (see Stuk/jszip#663)
@fuscoem
Copy link

fuscoem commented Dec 14, 2020

Any update on this issue? Is it still downgrading to 3.2.2 the only solution to use generateNodeStream in a browser environment?

@vooit
Copy link

vooit commented May 12, 2021

I have same experience in node 14...

@simpros
Copy link

simpros commented Oct 7, 2021

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants