Coder Social home page Coder Social logo

pdfjsLib is undefined about ng2-pdf-viewer HOT 12 CLOSED

Vi-dot avatar Vi-dot commented on May 28, 2024
pdfjsLib is undefined

from ng2-pdf-viewer.

Comments (12)

Vi-dot avatar Vi-dot commented on May 28, 2024

It's strange because I have not this problem with 1.0.2 release. What is the right way to produce dist directory ?

from ng2-pdf-viewer.

VadimDez avatar VadimDez commented on May 28, 2024

Are you just cloning master branch, did i understand right ?

from ng2-pdf-viewer.

Vi-dot avatar Vi-dot commented on May 28, 2024

Yes just master branch, you understand right

from ng2-pdf-viewer.

VadimDez avatar VadimDez commented on May 28, 2024

i made mistake and started to developed 2.0.0 in master... so it's not yet ready there

from ng2-pdf-viewer.

Vi-dot avatar Vi-dot commented on May 28, 2024

Ok, but the thing is I have also this error with my previous stable fork (#pdfviewer-way-pr).
I don't understand where it comes from, as I don't know fine how works configurations in angular-cli.
Have you also this error with master ?
What the difference between master and 1.0.2 about library linking ? (because 1.0.2 don't gives this error)

from ng2-pdf-viewer.

shabbir-dhangot avatar shabbir-dhangot commented on May 28, 2024

I am facing same issue.
This is entry in my package.json folder
"ng2-pdf-viewer": "1.0.2",

How to solve this?

from ng2-pdf-viewer.

Vi-dot avatar Vi-dot commented on May 28, 2024

I get also this error during testing library with the demo app, npm run all gives a better trace :

Error: (SystemJS) pdfjsLib is undefined
	@http://localhost:8000/lib/pdfjs-dist/web/pdf_viewer.js:125:5
	__w_pdfjs_require__@http://localhost:8000/lib/pdfjs-dist/web/pdf_viewer.js:45:12
	@http://localhost:8000/lib/pdfjs-dist/web/pdf_viewer.js:2659:15
	__w_pdfjs_require__@http://localhost:8000/lib/pdfjs-dist/web/pdf_viewer.js:45:12
	@http://localhost:8000/lib/pdfjs-dist/web/pdf_viewer.js:3367:25
	__w_pdfjs_require__@http://localhost:8000/lib/pdfjs-dist/web/pdf_viewer.js:45:12
	@http://localhost:8000/lib/pdfjs-dist/web/pdf_viewer.js:91:18
	@http://localhost:8000/lib/pdfjs-dist/web/pdf_viewer.js:26:18
	@http://localhost:8000/pdf-viewer/pdf-viewer.component.js:18:1
	@http://localhost:8000/pdf-viewer/pdf-viewer.component.js:1:31
	@http://localhost:8000/pdf-viewer/pdf-viewer.component.js:1:2
	@http://localhost:8000/app/app.component.js:12:30
	@http://localhost:8000/app/app.component.js:1:31
	@http://localhost:8000/app/app.component.js:1:2
	@http://localhost:8000/app.module.js:14:23
	@http://localhost:8000/app.module.js:1:31
	@http://localhost:8000/app.module.js:1:2
	@http://localhost:8000/main.js:3:20
	@http://localhost:8000/main.js:1:31
	@http://localhost:8000/main.js:1:2
	ZoneDelegate.prototype.invoke@http://localhost:8000/lib/zone.js/dist/zone.js:232:17
	Zone.prototype.run@http://localhost:8000/lib/zone.js/dist/zone.js:114:24
	scheduleResolveOrReject/<@http://localhost:8000/lib/zone.js/dist/zone.js:502:52
	ZoneDelegate.prototype.invokeTask@http://localhost:8000/lib/zone.js/dist/zone.js:265:21
	Zone.prototype.runTask@http://localhost:8000/lib/zone.js/dist/zone.js:154:28
	drainMicroTaskQueue@http://localhost:8000/lib/zone.js/dist/zone.js:401:25
	ZoneTask/this.invoke@http://localhost:8000/lib/zone.js/dist/zone.js:339:25
	
	Evaluating http://localhost:8000/pdf-viewer/pdf-viewer.component.js
	Evaluating http://localhost:8000/app/app.component.js
	Evaluating http://localhost:8000/app.module.js
	Evaluating http://localhost:8000/main.js
	Error loading http://localhost:8000/main.js

from ng2-pdf-viewer.

Vi-dot avatar Vi-dot commented on May 28, 2024

There is an other trace after gulp build

[12:01:46] 'compile' errored after 5.24 s
[12:01:46] Error: Command failed: ./node_modules/.bin/ngc -p tsconfig-aot.json
Error at /it/_ng2-pdf-viewer/node_modules/@types/jasmine/index.d.ts:39:38: A parameter initializer is only allowed in a function or constructor implementation.
Error at /it/_ng2-pdf-viewer/node_modules/@types/jasmine/index.d.ts:39:46: Cannot find name 'keyof'.
Error at /it/_ng2-pdf-viewer/node_modules/@types/jasmine/index.d.ts:39:52: '=' expected.

    at ChildProcess.exithandler (child_process.js:211:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:885:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

npm ERR! Linux 4.4.0-62-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v7.4.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `gulp build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script 'gulp build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ng2-pdf-viewer package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     gulp build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ng2-pdf-viewer
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ng2-pdf-viewer
npm ERR! There is likely additional logging output above.

from ng2-pdf-viewer.

Vi-dot avatar Vi-dot commented on May 28, 2024

@VadimDez
I almost sure that this bug appears only with lastest node/npm.
As @shabbir-dhangot I cannot even build 1.0.2 from branch features/1.0.2.
Which version of node/npm do you used to build 1.0.2 release ?

from ng2-pdf-viewer.

VadimDez avatar VadimDez commented on May 28, 2024

@Vi-dot I'm using node v6.9.5 and npm 4.2.0

from ng2-pdf-viewer.

Vi-dot avatar Vi-dot commented on May 28, 2024

@VadimDez still not works :/ Strange
I clear and tried to build features/1.0.2 with those versions :

node v6.9.5
npm  v3.10.10

from ng2-pdf-viewer.

Vi-dot avatar Vi-dot commented on May 28, 2024

I fixed it by adding at begging this include :
"../node_modules/pdfjs-dist/build/pdf.js"

Then if you have an angular-cli project, add this path in angular-cli.json in "scripts" field.

I don't know if it exists a best solution to include it in ng2-pdf-viewer instead of project.

from ng2-pdf-viewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.