Open hendras1722 opened 3 years ago
@hendras1722 can you share the version of library and version of its peer dependency pdfjs-dist
The below solution works for me First, install npm install npm-force-resolutions --save-dev
Then in package.json we need to override the pdfjs-dist version to previous working version like this
"dependencies": { "pdf-viewer-reactjs": "2.2.3", }. "scripts": { "preinstall": "npx npm-force-resolutions" }, "resolutions": { "pdfjs-dist": "2.6.347" } and in scripts section add new preinstall entry:
"preinstall": "npx npm-force-resolutions", now if you do npm install and run your application it should work. Hope it helps
The root cause of the problem is , though in the dependency package.json has version 2.6.347 for pdfjs-dist since ^ was there before the version number during npm install, it installs the most recent version of pdfjs-dist which is causing this problem.
Describe the bug How to fix this. when run react I found error. ./node_modules/pdfjs-dist/build/pdf.js 3454:145 Module parse failed: Unexpected token (3454:145) File was processed with these loaders:
How to Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
Screenshots Please add screenshots to help explain your problem.![image](https://user-images.githubusercontent.com/57746184/122020092-aa6b4780-cdee-11eb-94da-067afa9b8c88.png)
PDF File Please attach the pdf file.
Details (please complete the following information):
Additional context Add any other context about the problem here.