Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Module not found: Error: Can't resolve 'stream' in 'C:\dev\jszip-test\node_modules\jszip\lib'

I'm using jszip v3.2.1 in an angular 7 application. When I build my project (running, for example, npm start) I'm getting the following error:

ERROR in ./node_modules/jszip/lib/readable-stream-browser.js

Module not found: Error: Can't resolve 'stream' in 'C:\dev\jszip-test\node_modules\jszip\lib'

How can I solve this problem?

like image 935
Ricardo Rocha Avatar asked Apr 09 '19 21:04

Ricardo Rocha


3 Answers

After reading this post I found out that the stream package was missing from my project.

You can install it by running the following command:

npm i stream
like image 117
Ricardo Rocha Avatar answered Oct 22 '22 16:10

Ricardo Rocha


In my case, I wanted to import EventEmitter and added it accidentally from stream package instead of @angular/core package.

like image 6
Martin Staufcik Avatar answered Oct 22 '22 16:10

Martin Staufcik


This issue encountered when importing web3 to your project. Please follow steps in below article.

https://medium.com/@rasmuscnielsen/how-to-compile-web3-js-in-laravel-mix-6eccb4577666

Fix is:-

Wherever you import the web3 library, change your import from

import Web3 from 'web3'

to import Web3 from 'web3/dist/web3.min.js'

like image 5
kemparaj565 Avatar answered Oct 22 '22 15:10

kemparaj565