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 find module '@napi-rs/canvas' #84

Open
GiriReddy10 opened this issue Dec 3, 2024 · 5 comments
Open

Cannot find module '@napi-rs/canvas' #84

GiriReddy10 opened this issue Dec 3, 2024 · 5 comments

Comments

@GiriReddy10
Copy link

GiriReddy10 commented Dec 3, 2024

Error: Cannot find module '@napi-rs/canvas'
Require stack:

  • /home/runner/work/pdf.js/pdf.js/src/display/node_utils.js

    at utils/pdfUtils.js:11

Sorry to bother you with another issue. After upgrading to latest version 0.13.0 - runs were fine for couple of days. Then starting yesterday - it started failing with above issue.

All the dev dependencies I am using

"devDependencies": {
"@faker-js/faker": "8.0.2",
"@playwright/test": "^1.35.1",
"date-and-time": "^2.0.0",
"express": "^4.19.2",
"p-retry": "^4.6.1",
"playwright": "^1.35.1",
"prettier": "3.3.3",
"supertest": "^6.1.6",
"pdf-lib": "^1.17.1",
"pdf-visual-diff": "^0.12.0",
"card-number-generator": "^0.0.2"
}

npm - 10.8.2
node - v20.17.0

@jrohland
Copy link

jrohland commented Dec 4, 2024

Looks like it's an issue with the latest pdfjs-dist switching to a new canvas project: mozilla/pdf.js#19145

You should be able to use an older version like 4.8.69.

@moshensky
Copy link
Owner

Latest pdfjs-dist release 4.9.124 replaced node-canvas with @napi-rs/canvas as well as updated Node.js minimum supported version to v20.

I will look into updating pdf-visual-diff to support latest pdfjs-dist asap. Until than it would be best to make sure one is using pdfj-dist v4.8.69 as suggested by @jrohland.

@GiriReddy10
Copy link
Author

GiriReddy10 commented Dec 5, 2024 via email

@moshensky
Copy link
Owner

I have just published new v0.14.0. Please check the changelog, because there are breaking changes. Although it shouldn't be a big deal.

@jrohland
Copy link

jrohland commented Dec 6, 2024

Thanks for the update, pdfjs and the old canvas library not providing builds was holding us back from upgrading to node v22. With the move to the new canvas library it looks good to update to node v22.

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

No branches or pull requests

3 participants