Yarn 安装在 PROD 构建上失败。错误 - "chalk@4.1.0: The engine "node“与此模块不兼容”

Yarn Install failing on PROD build. Error - "chalk@4.1.0: The engine "node" is incompatible with this module"

我正在 PROD 环境中部署 ReactJS 项目。 早些时候它工作正常但现在命令“Yarn install”失败。

获取错误

info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
error chalk@4.1.0: The engine "node" is incompatible with this module. Expected version ">=10".
error Found incompatible module

pacakage.json

中没有任何代码更改

原因可能是 Chalk 版本 4 中的重大更改[1]。再次确保您是否真的在生产环境中使用节点版本 10.x。直接在部署管道中打印出版本(node -v)最简单