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

5

28

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?

Inartificial answered 9/4, 2019 at 21:35 Comment(0)
I
71

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
Inartificial answered 9/4, 2019 at 21:37 Comment(2)
it is a bug in "readable-stream" itself, it is missing package stream in the dependencies.Easley
When I do this, an error message pops up that shows Uncaught TypeError: Super expression must either be null or a function, not undefined. How to solve (create-react-app, brain.js)Spade
K
28

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

Krol answered 7/5, 2022 at 16:56 Comment(0)
U
6

I encountered this error while building an angular library.

It came from my IDE auto-importing EventEmitter from 'stream' instead of '@angular/core' in the library.

Check for:

import { EventEmitter } from "stream";

Update to:

import { EventEmitter } from "@angular/core";
Untwine answered 3/8, 2022 at 9:56 Comment(0)
C
5

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'

Chandlery answered 14/5, 2022 at 19:30 Comment(0)
C
0

edit your package.json, change react-scripts to 4.0.3 and run yarn / npm install

Colmar answered 29/7, 2022 at 9:23 Comment(1)
This is an angular question, not a react one.Peltier

© 2022 - 2024 — McMap. All rights reserved.