question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to build project with JSZip library

See original GitHub issue

Versions

Angular CLI: 6.0.0
Node: 8.11.1
OS: win32 x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/build-angular     0.6.0
@angular-devkit/build-optimizer   0.6.0
@angular-devkit/core              0.6.0
@angular-devkit/schematics        0.6.0
@ngtools/webpack                  6.0.0
@schematics/angular               0.6.0
@schematics/update                0.6.0
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0

Repro steps

  • ng new jszip-test
  • cd .\jszip-test\
  • npm i --save jszip
  • Add the following code in app.component.ts:
import * as JSZip from 'jszip';
...
constructor() {
    const zip = new JSZip();
}
  • ng build

Observed behavior

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'

Desired behavior

Should be able to build a project without errors.

Mention any other details that might be useful (optional)

This works as expected with angular-cli 1.7

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:13
  • Comments:40 (6 by maintainers)

github_iconTop GitHub Comments

53reactions
aifrimcommented, May 22, 2018

npm i stream - worked for me

19reactions
kodermaxcommented, May 10, 2018

It was hot fix. Right fix: tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "paths": {
      "jszip": [
        "../node_modules/jszip/dist/jszip.js"
      ]
    },
    "lib": [
      "es2017",
      "dom"
    ]
  }
}

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSZip problem updating to wijmo 5.20191... in Angular project
Failed to build project with JSZip library ... Module not found: Error: Can't resolve 'jszip' in It seems that the JSZip module is...
Read more >
Module not found: Error: Can't resolve 'stream' in 'C:\dev\jszip ...
After reading this post I found out that the stream package was missing from my project. You can install it by running the...
Read more >
A project's compilation fails with the "Can't resolve 'stream ...
I've tried creating a clean Angular 6 project and just adding DevExtreme, but the results are the same.
Read more >
JSZip
JSZip is a javascript library for creating, reading and editing .zip files, with a lovely and simple API. Current version : v3.10.1.
Read more >
How to use the jszip.support function in jszip - Snyk
textLayerMD5) { const textLayerFile = zip.file(textLayerFileName); if (!textLayerFile) { log.error(`Could not find text layer file associated with the ${costume ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found