Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React PDF is not working with fresh React installation using Vite #2067

Closed
sulemankhann opened this issue Nov 2, 2022 · 8 comments · Fixed by #2202
Closed

React PDF is not working with fresh React installation using Vite #2067

sulemankhann opened this issue Nov 2, 2022 · 8 comments · Fixed by #2202

Comments

@sulemankhann
Copy link

I have a fresh react application which I installed using vite library. In fresh react application I installed react-pdf and put the basic getting started code from react-pdf site but I am getting errors:
Cannot read properties of undefined (reading 'call')
The above error occurred in the <PDFViewer2> component:at PDFViewer2

To Reproduce
Steps to reproduce the behavior including code snippet (if applies):

  1. install react using vite
  2. install react-pdf
  3. put getting started react-pdf code to view the pdf file
  4. check console for the errors

The expected behavior should be shown the pdf file

Attached are screenshots of the code and the error
Screen Shot 2022-11-02 at 8 31 19 AM
Screen Shot 2022-11-02 at 8 25 01 AM

  • OS: MacOS
  • Browser: chrome, safari
  • React-pdf version v3.0.0
@simonurmi
Copy link

Try this #1879 (comment)

@gustavekuetenang
Copy link

Hello, I am facing the same issue. Any solution please.

@raibtoffoletto
Copy link

I can confirm that manually adding the events package ( yarn add events ) solves this issue!

@SteveTro
Copy link

SteveTro commented Jan 3, 2023

I have the same problem, manually adding the events package did not solve it for me.

@SalamanderXing
Copy link

Same issue here

@jeetiss jeetiss mentioned this issue Feb 17, 2023
@JK369x
Copy link

JK369x commented Feb 21, 2023

Same issue, How to solve a problem

@jeetiss
Copy link
Collaborator

jeetiss commented Feb 21, 2023

@JK369x update to the latest version it should work with vite from the box

@JK369x
Copy link

JK369x commented Feb 21, 2023

@JK369x update to the latest version it should work with vite from the box
ty, work sir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants