'The engine “node” is incompatible with this module when installing React-chartjs-2 Chart.js,
I am creating a doughnut chart by using chart.js with its react wrapper. It's working fine in the new project, but not able to install it in the main project.
Below is an example of a new project where it's working fine.
And below is the example of the main old project, where I am not able to install it
Error:
The engine “node” is incompatible with this module
Node version is the same, you can check in both images.
Solution 1:[1]
You need to upgrade your node version. As you are using husky v4, you need node >= 10.
Check husky installation guide and The engine “node” is incompatible with this module.
Solution 2:[2]
From the log, I can see that this is an issue with the version of the node you are currently having. See this line in your log
The engine "node" is incompatible with the module. Expected version ">=10". Got "8.10.0"
To solve this, you could try this
1. Install nvm
2. Download another version of node ">=10"
3. Switch to that the latest version
4. And try installing the module again
Solution 3:[3]
For anyone on Husky v7
, and using VSCode
:
VSCode can use a different shell to your standard one. In my case, it was using bash
instead of zsh
- which did not have nvm installed and therefore was not using the correct version of node.
Fix:
- Open the Command Palette in VSCode - ? + ? + P
- Type
Terminal: Select Default Profile
- Select the terminal that you have set up nvm or similar on.
- Restart VSCode
- ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ajeet Shah |
Solution 2 | Sulaiman Abiodun |
Solution 3 | Jamie |