问题描述:

1. 拉取平台代码后,使用yarn install命令安装依赖,当前的node版本为16.17.0,但是报错

1
2
3
error commander@12.0.0: The engine "node" is incompatible with this module.
Expected version ">=18". Got "16.17.0"
error Found incompatible module.

2. 尝试升级node版本为18.12.0后,再次执行yarn install,发现出现了新的报错

1
2
error @achrinza/node-ipc@9.2.2: The engine "node" is incompatible with this module.
Expected version "8 || 10 || 12 || 14 || 16 || 17". Got "18.12.0"

3. 综上两点错误,说明升级node版本并不能解决问题,google该问题以求解决方案

解决方案:

使用 yarn config set ignore-engines true 命令来解决部分模块版本不兼容问题,然后使用yarn install --force命令安装相关依赖

yarn config set ignore-engines true