react-pdf: Webpack version inconsistency after `npm update`

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

Whenever I run an npm update command to update other packages and after that I try an npm run start or npm run build I get following error message:

Screenshot 2021-12-20 at 09 28 41

The only way I currently found to fix this is to manually remove the node_modules folder and delete the package-lock.json file, uninstall react-pdf, run a clean npm install and only afterwards run once more npm i react-pdf. How can I fix this?

Steps to reproduce

  1. Install latest version
  2. Downgrade another package
  3. Run npm update
  4. Run npm run start or npm run build

Expected behavior

Should not have webpack inconsistency

Actual behavior

Screenshot 2021-12-20 at 09 28 41

Additional information

No response

Environment

- **Browser (if applicable)**: Version 98.0.4758.9 (Official Build) dev (arm64)
- **React-PDF version**: 5.6.0
- **React version**: 17.0.1
- **Webpack version (if applicable)**:

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (12 by maintainers)

Most upvoted comments

Note that peerDependencies are now installed by default in npm7+, so probably we also should mark the dependency as optional: https://docs.npmjs.com/cli/v8/configuring-npm/package-json#peerdependenciesmeta