I was trying to migrate my angular 5 code to angular 6.
After doing npm start getting the below problem
npm start
WARNING in ./node_modules/pdfjs-dist/build/pdf.js
Module not found: Error: Can't resolve 'zlib' in '\ui_angular_6\node_modules\pdfjs-dist\build'
Package.json
"dependencies": {
"@angular/animations": "6.0.2",
"@angular/common": "6.0.2",
"@angular/compiler": "6.0.2",
"@angular/core": "6.0.2",
"@angular/flex-layout": "^6.0.0-beta.15",
"@angular/forms": "6.0.2",
"@angular/http": "6.0.2",
"@angular/platform-browser": "6.0.2",
"@angular/platform-browser-dynamic": "6.0.2",
"@angular/router": "6.0.2",
"@ng-bootstrap/ng-bootstrap": "^1.1.2",
"angular-font-awesome": "^3.1.2",
"body-parser": "^1.18.2",
"bootstrap": "^4.1.0",
"core-js": "^2.4.1",
"elasticsearch": "^15.1.1",
"elasticsearch-browser": "^15.1.1",
"express": "^4.16.3",
"font-awesome": "^4.7.0",
"jquery": "^3.3.1",
"ng2-pdf-viewer": "^5.1.1",
"npm": "^6.0.1",
"popper.js": "^1.14.3",
"rxjs": "^6.1.0",
"rxjs-compat": "^6.1.0",
"underscore": "^1.8.3",
"zone.js": "^0.8.26"
}
Please help me to fix this issue.
Try by placing this in your package.json file:
"browser": {
"zlib":false }
There was a fix for this issue in the following PR https://github.com/mozilla/pdf.js/pull/9924 (merged 12 days ago). You may want upgrading to the latest "pdfjs-dist" to fix the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With