hardDependenciesReact

The module clash

A developer asked an AI assistant to add a chart library to a React 19 project. The suggested install command succeeds without any errors, but the running app crashes with 'Invalid hook call' the moment the chart component renders.

install.sh
npm install awesome-charts@2.4.0
# awesome-charts@2.4.0 lists "react": "^17.0.0" as a peer dependency

Why does a chart component throw 'Invalid hook call' even though the install succeeded cleanly?

npm silently installed a second copy of React 17 inside the library's node_modules to satisfy its outdated peer dependency, so the app runs two different React instances at once.
The install succeeded, so the peer dependency range is irrelevant to any runtime behavior.
Invalid hook call always means a hook was called conditionally inside an if statement.
awesome-charts doesn't actually use React internally, so the error must come from a different package entirely.

Sign in with GitHub to submit an answer and track your progress.