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.

Module x has no exported member 'PDFDocumentProxy' +n

See original GitHub issue
Bug Report or Feature Request (mark with an x)

Hello guys.

There’s some trouble with this package.

I use following angular specs: Fresh installation of Angular and only added ng2-pdf-viewer

    "@angular/animations": "~11.1.0",
    "@angular/common": "~11.1.0",
    "@angular/compiler": "~11.1.0",
    "@angular/core": "~11.1.0",
    "@angular/forms": "~11.1.0",
    "@angular/platform-browser": "~11.1.0",
    "@angular/platform-browser-dynamic": "~11.1.0",
    "@angular/router": "~11.1.0",
    "ng2-pdf-viewer": "^6.3.2",
    "rxjs": "~6.6.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.11.3"

I registered the PdfViewerModule in app.module.ts. Nothing else done. No deps, no tricky relations. Clean angular + import of PdfViewerModule

Running ng serve

AND GET THIS

Error: node_modules/ng2-pdf-viewer/src/app/pdf-viewer/pdf-viewer.component.d.ts:5:10 - error TS2305: Module '"../../../../pdfjs-dist/types/pdf"' has no exported member 'PDFDocumentProxy'.

5 import { PDFDocumentProxy, PDFSource, PDFProgressData } from 'pdfjs-dist';
           ~~~~~~~~~~~~~~~~


Error: node_modules/ng2-pdf-viewer/src/app/pdf-viewer/pdf-viewer.component.d.ts:5:28 - error TS2305: Module '"../../../../pdfjs-dist/types/pdf"' has no exported member 'PDFSource'.

5 import { PDFDocumentProxy, PDFSource, PDFProgressData } from 'pdfjs-dist';
                             ~~~~~~~~~


Error: node_modules/ng2-pdf-viewer/src/app/pdf-viewer/pdf-viewer.component.d.ts:5:39 - error TS2305: Module '"../../../../pdfjs-dist/types/pdf"' has no exported member 'PDFProgressData'.

5 import { PDFDocumentProxy, PDFSource, PDFProgressData } from 'pdfjs-dist';
                                        ~~~~~~~~~~~~~~~


Error: node_modules/ng2-pdf-viewer/src/app/pdf-viewer/pdf-viewer.module.d.ts:1:10 - error TS2305: Module '"../../../../pdfjs-dist/types/pdf"' has no exported member 'PDFJSStatic'.

1 import { PDFJSStatic } from 'pdfjs-dist';
           ~~~~~~~~~~~


Error: node_modules/ng2-pdf-viewer/src/app/pdf-viewer/pdf-viewer.module.d.ts:7:10 - error TS2305: Module '"../../../../pdfjs-dist/types/pdf"' has no exported member 'PDFJSStatic'.

7 export { PDFJSStatic, PDFDocumentProxy, PDFViewerParams, PDFPageProxy, PDFSource, PDFProgressData, PDFPromise } from 'pdfjs-dist';
           ~~~~~~~~~~~


Error: node_modules/ng2-pdf-viewer/src/app/pdf-viewer/pdf-viewer.module.d.ts:7:100 - error TS2305: Module '"../../../../pdfjs-dist/types/pdf"' has no exported member 'PDFPromise'.

7 export { PDFJSStatic, PDFDocumentProxy, PDFViewerParams, PDFPageProxy, PDFSource, PDFProgressData, PDFPromise } from 'pdfjs-dist';
                                                                                                     ~~~~~~~~~~


Error: node_modules/ng2-pdf-viewer/src/app/pdf-viewer/pdf-viewer.module.d.ts:7:23 - error TS2305: Module '"../../../../pdfjs-dist/types/pdf"' has no exported member 'PDFDocumentProxy'.

7 export { PDFJSStatic, PDFDocumentProxy, PDFViewerParams, PDFPageProxy, PDFSource, PDFProgressData, PDFPromise } from 'pdfjs-dist';
                        ~~~~~~~~~~~~~~~~


Error: node_modules/ng2-pdf-viewer/src/app/pdf-viewer/pdf-viewer.module.d.ts:7:41 - error TS2305: Module '"../../../../pdfjs-dist/types/pdf"' has no exported member 'PDFViewerParams'.

7 export { PDFJSStatic, PDFDocumentProxy, PDFViewerParams, PDFPageProxy, PDFSource, PDFProgressData, PDFPromise } from 'pdfjs-dist';
                                          ~~~~~~~~~~~~~~~


Error: node_modules/ng2-pdf-viewer/src/app/pdf-viewer/pdf-viewer.module.d.ts:7:58 - error TS2305: Module '"../../../../pdfjs-dist/types/pdf"' has no exported member 'PDFPageProxy'.

7 export { PDFJSStatic, PDFDocumentProxy, PDFViewerParams, PDFPageProxy, PDFSource, PDFProgressData, PDFPromise } from 'pdfjs-dist';
                                                           ~~~~~~~~~~~~


Error: node_modules/ng2-pdf-viewer/src/app/pdf-viewer/pdf-viewer.module.d.ts:7:72 - error TS2305: Module '"../../../../pdfjs-dist/types/pdf"' has no exported member 'PDFSource'.

7 export { PDFJSStatic, PDFDocumentProxy, PDFViewerParams, PDFPageProxy, PDFSource, PDFProgressData, PDFPromise } from 'pdfjs-dist';
                                                                         ~~~~~~~~~


Error: node_modules/ng2-pdf-viewer/src/app/pdf-viewer/pdf-viewer.module.d.ts:7:83 - error TS2305: Module '"../../../../pdfjs-dist/types/pdf"' has no exported member 'PDFProgressData'.

7 export { PDFJSStatic, PDFDocumentProxy, PDFViewerParams, PDFPageProxy, PDFSource, PDFProgressData, PDFPromise } from 'pdfjs-dist';

To reproduce this just:

  • Install fresh angular project
  • Add ng2-pdf-viewer
  • Import that module in app.module.ts or wherever you need it
  • Get the error

In node_modules there is @types/pdfjs-dist BUT ng2-pdf-viewer doesn’t use it.

I tried to reinstall, to install @types/pdfjs-dist @types/node and rolled back to lower node version. Nothing helps. I am very hard relied on that package for coming rollout these days.

Can anyone good guy help to fix this?

Shake your hands, dudes.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:23
  • Comments:29 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
VadimDezcommented, Feb 16, 2021

Fixed in version 6.4.0

4reactions
TeemuKoivistocommented, Apr 12, 2021

Hey people. I’m not using this library, just pdfjs-dist directly, but I fixed the types (as shown here https://github.com/mozilla/pdf.js/issues/12384#issuecomment-695138631) by importing them as following:

import type {
  PDFDocumentProxy, PDFDocumentLoadingTask
} from 'pdfjs-dist/types/display/api'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript: Module X has no exported member Y
I got it to work and I believe I found the problem. Above the import I had another import that must caused the...
Read more >
Module x has no exported member 'PDFDocumentProxy' +n
Coming soon: A brand new website interface for an even better experience!
Read more >
module '"react-router-dom"' has no exported member ...
esm.js Attempted import error: 'useRouteMatch' is not exported from 'react-router-dom'.
Read more >
Module has no exported member error in TypeScript
The error "Module has no exported member" occurs when we try to import a member that doesn't exist in the specified module. To...
Read more >
mozilla-central: changeset 398058 ... - Mercurial
PDFDocumentProxy = PDFDocumentProxy; exports. ... If a copy of the MPL was not distributed with this * file, You can obtain one at ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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