安装React-chartjs-2 Chart.js时,引擎“节点”与此模块不兼容,

时间:2020-10-15 06:03:38

标签: javascript node.js reactjs chart.js react-chartjs-2

我通过使用带有其响应包装器的chart.js创建一个甜甜圈图。在新项目中可以正常工作,但不能在主项目中安装它。

下面是一个新项目的示例,该项目运行正常。

enter image description here

下面是主要旧项目的示例,我无法在其中安装

enter image description here

错误:

引擎“节点”与此模块不兼容

节点版本相同,您可以检入两个图像。

2 个答案:

答案 0 :(得分:0)

您需要升级节点版本。。在使用husky v4时,您需要 node> = 10

选中husky installation guideThe engine “node” is incompatible with this module

答案 1 :(得分:0)

从日志中,我可以看到这与您当前拥有的节点版本有关。在您的日志中看到这一行

The engine "node" is incompatible with the module. Expected version ">=10". Got "8.10.0"

要解决此问题,您可以尝试

 1. Install nvm
 2. Download another version of node ">=10"
 3. Switch to that the latest version
 4. And try installing the module again