yarn add @mui/x-date-pickers安装时报错,报错信息如下
error expect@28.1.3: The engine "node" is incompatible with this module. Expected version "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0". Got "16.4.2"
error Found incompatible module.
解决方案(2个)
方案1:卸载node重装指定版本范围的
查看本地node版本
PS C:\Users> node --version
v16.4.2
安装指定版本node
方案2:忽略错误后重新add
yarn config set ignore-engines true
PS E:\> yarn config set ignore-engines true
yarn config v1.22.10
success Set "ignore-engines" to "true".
Done in 0.05s.
yarn add @mui/x-date-pickers
PS E:\> yarn add @mui/x-date-pickers
yarn add v1.22.10
.....
success Saved lockfile.
success Saved 7 new dependencies.
info Direct dependencies
└─ @mui/x-date-pickers@5.0.4
info All dependencies
├─ @date-io/date-fns@2.16.0
├─ @date-io/dayjs@2.16.0
├─ @date-io/luxon@2.16.0
├─ @date-io/moment@2.16.0
├─ @mui/utils@5.10.9
├─ @mui/x-date-pickers@5.0.4
└─ rifm@0.12.1
Done in 1109.47s.