wojtekmaj / react-pdf

Display PDFs in your React app as easily as if they were images.

Home Page:https://projects.wojtekmaj.pl/react-pdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot find module '../build/Release/canvas.node' error when running jest test

courtneypattison opened this issue · comments

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

My Jest tests fail to run with the error message Cannot find module '../build/Release/canvas.node' when I have react-pdf installed.

Steps to reproduce

pnpm test

Expected behavior

Tests should run

Actual behavior

Cannot find module '../build/Release/canvas.node'

Additional information

$ pnpm rebuild
node_modules/.pnpm/canvas@2.11.2/node_modules/canvas: Running install script, failed in 1.1s (skipped as optional)

$ pnpm why canvas
dependencies:
react-pdf 7.7.0
└─┬ pdfjs-dist 3.11.174
  └── canvas 2.11.2

Environment

  • React-PDF version: 7.7.0
  • React version: 18.2.0
  • Next version: 13.4.19