The engine “node” is incompatible with this module when installing React-chartjs-2 Chart.js,

1.7k views Asked by At

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.

enter image description here

And below is the example of the main old project, where I am not able to install it

enter image description here

Error:

The engine “node” is incompatible with this module

Node version is the same, you can check in both images.

3

There are 3 answers

3
Ajeet Shah On BEST ANSWER

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.

0
Sulaiman Abiodun On

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

0
Jamie On

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:

  1. Open the Command Palette in VSCode - + + P
  2. Type Terminal: Select Default Profile
  3. Select the terminal that you have set up nvm or similar on.
  4. Restart VSCode