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

Cannot set properties of undefined (setting 'workerSrc') #1662

Closed
4 tasks done
panwaranuj01 opened this issue Nov 8, 2023 · 6 comments
Closed
4 tasks done

Cannot set properties of undefined (setting 'workerSrc') #1662

panwaranuj01 opened this issue Nov 8, 2023 · 6 comments
Labels
bug Something isn't working stale

Comments

@panwaranuj01
Copy link

panwaranuj01 commented Nov 8, 2023

Before you start - checklist

  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported
  • I have checked if an issue is not listed in Known issues
  • If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

TypeError: Cannot set properties of undefined (setting 'workerSrc')\n at ./node_modules/react-pdf/dist/esm/index.js

import React, { useState } from "react";
import { Document, Page, pdfjs } from 'react-pdf';

import "react-pdf/dist/esm/Page/AnnotationLayer.css";
import "react-pdf/dist/esm/Page/TextLayer.css";
pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/legacy/build/pdf.worker.min.js`;

Steps to reproduce

I have just imported this

Expected behavior

My react app should load

Actual behavior

My react app is not loading

Additional information

No response

Environment

  • Browser (if applicable):
  • React-PDF version: "^7.5.1"
  • React version:" 16.9.0"
  • Webpack version (if applicable):
@panwaranuj01 panwaranuj01 added the bug Something isn't working label Nov 8, 2023
@tonykhaov
Copy link

Hey did you check that you don't have pdfjs-dist in your package.json? I had the same issue and fixed it by removing pdfjs-dist dependency

@wojtekmaj wojtekmaj marked this as a duplicate of #1579 Jan 10, 2024
@wojtekmaj wojtekmaj closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2024
@wojtekmaj wojtekmaj marked this as not a duplicate of #1579 Jan 10, 2024
@wojtekmaj wojtekmaj reopened this Jan 10, 2024
@neerajkatiyar
Copy link

@wojtekmaj Could you please provide us a fix for v5.7.2

@wojtekmaj
Copy link
Owner

@wojtekmaj Could you please provide us a fix for v5.7.2

Sorry, not a chance. This version is no longer supported. I don't have capacity to maintain multiple versions.

@neerajkatiyar
Copy link

No problem, I can understand, we will upgrade to the latest version.
Thanks

Copy link
Contributor

github-actions bot commented May 6, 2024

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days.

@github-actions github-actions bot added the stale label May 6, 2024
Copy link
Contributor

This issue was closed because it has been stalled for 14 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

4 participants