wojtekmaj / react-pdf

Display PDFs in your React app as easily as if they were images.
https://projects.wojtekmaj.pl/react-pdf
MIT License
9.11k stars 867 forks source link

Module parse failed: Unexpected token #1711

Closed sahinpathan closed 6 months ago

sahinpathan commented 6 months ago

Before you start - checklist

Description

I am currently using the versions "react-pdf": "4.1.0" and "react": "^16.1.1". Previously, my implementation with react-pdf was functioning correctly. However, yesterday, I deleted the node_modules directory and executed npm install. Since then, my code has encountered an error, and I am seeking assistance to resolve this issue. Any guidance or support would be greatly appreciated.

image

Steps to reproduce

do npm i

Expected behavior

it should show pdf

Actual behavior

it is giving error

Additional information

No response

Environment

jd-carroll commented 6 months ago

I think this is an issue with @react-pdf/textkit

The version you are using is incorrect, please validate my assertion that you are using @react-pdf/textkit@4.4.0 (Note: You may need to go into the node_modules folder to explicitly look at the dependency)

sahinpathan commented 6 months ago

@jd-carroll I have found this @react-pdf/textkit in my package-lock.json and it is correct i think 4.4.0. it is internal dependency of react-pdf.

image

jd-carroll commented 6 months ago

Wrong project: https://github.com/diegomura/react-pdf/issues/2603

sahinpathan commented 6 months ago

Do you have any workaround for this. like what can i do to fix this error temporary?

wojtekmaj commented 6 months ago

It looks like you confused React-PDF with @react-pdf/renderer. Please file an issue in their repo instead.