Closed cravend closed 11 months ago
I'd prefer not to install a bunch of random brew packages to build an optional sub-sub dependency. Is there a way to suppress this error / not attempt to install canvas at all? Or is something I should open an issue about on their side?
With Yarn, you could try and use Yarn Resolutions to replace canvas
module with an empty module you can put in your repository. Something like export default {}
. Let me know if this works.
Feel free to install: brew install pkg-config cairo pango
I am using Yarn 1 so the resolutions config was a little different, but this works for me:
"resolutions": {
"canvas": "link:./node_modules/.cache/null"
},
(solution found on slackoverflow)
p.s. using pnpm
suppresses the failed output for optional dependencies, instead outputting just one line of warning:
node_modules/.pnpm/canvas@2.11.2/node_modules/canvas: Running install script, failed in 1.4s (skipped as optional)
Since Next.js specific instructions are now properly documented in README, including solution for this problem, and since Next.js working samples are provided as well, I'm closing this. Please refer to README and samples for the latest recommended settings.
For what it’s worth, we aren’t using Next.js in our build. However, as explained above the resolutions is a way to override this issue if necessary (so I think it’s good to close)
Before you start - checklist
Description
When I installed
react-pdf@7.3.3
, I started getting the following error every time I runyarn install
. PDFs are still rendered properly. This does not happen onreact-pdf@6.2.2
but does onreact-pdf@7.0.0
.Steps to reproduce
react-pdf@7.3.3
Expected behavior
No error should be produced
Actual behavior
Additional information
No response
Environment