./node_modules/pdfjs-dist/build/pdf.js中的警告未找到模块:错误:无法解析'ui_angular_6 \ node_modules \ pdfjs-dist \ build'中的'zlib'

时间:2018-07-18 20:45:05

标签: angular6

我试图将我的5号代码迁移到6号。

执行npm后开始出现以下问题

   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"
    }

请帮助我解决此问题。

2 个答案:

答案 0 :(得分:1)

以下PR https://github.com/mozilla/pdf.js/pull/9924(在12天前合并)中已解决此问题。您可能需要升级到最新的“ pdfjs-dist”来解决该问题。

答案 1 :(得分:1)

尝试将其放在您的 package.json 文件中:

"browser": {    
"zlib":false  }