isaacs / sax-js

A sax style parser for JS
Other
1.09k stars 325 forks source link

Missing dependency 'stream' #237

Open aescarcha opened 6 years ago

aescarcha commented 6 years ago

When installing through NPM and running with webpack I get the following warning:

WARNING in ./node_modules/imsc/node_modules/sax/lib/sax.js
Module not found: Error: Can't resolve 'stream' in 'node_modules/imsc/node_modules/sax/lib'

I think the issue happens when Sax requires stream in this line

Doing an npm install stream solved the error for me, so adding it to the package.json dependencies should solve it too.

To reproduce this install a new Angular enviroment and npm i angular-dashjs-player

lolo32 commented 6 years ago

stream is a default nodejs module, like you could see at https://nodejs.org/docs/latest/api/stream.html I think it's your nodejs interpreter that miss it.

aescarcha commented 6 years ago

It looks like the issue is Angular6-specific, as you can see here . The best solution is using readable-stream instead of stream.

From readable-stream README:

If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use readable-stream only and avoid the "stream" module in Node-core, for background see this blogpost.

ALGDB commented 5 years ago

I had the same issue so far I solved it changing the "require('stream')" with require('readable-stream')

readable-stream

hriverahdez commented 5 years ago

Is there a way to remove the warning permanently without having to modify sax.js source?? I'm having the same issue on an angular app, although it's just a warning and it's working fine, but the warning is a bit annoying

Yelinz commented 4 years ago

Also had this problem and changed to require('readable-stream') in the source and it still worked without errors.

skorunka commented 4 years ago

Same issue with Angular app

skorunka commented 4 years ago

Check https://stackoverflow.com/a/55788098/522322

ALEXOTANO commented 1 year ago

If you're on Angular App, this is how I solve it:

  1. install
    npm install stream-browserify
  2. add the path to your `tsconfig.json
    "compilerOptions": {
    ...
    "paths": {
        ...
        "stream": ["node_modules/stream-browserify"],
    } 
    } 

I found out some people had the same issue with timers, so do the same with timers and timers-browserify.

Hope it helps.