📦Node 版本不匹配
error: The engine "node" is incompatible with this module. Expected version ">=20". Got "16.20.0"
你电脑上的 Node.js 版本比项目或软件包要求的版本低(或高)。
🤔 为什么会出现?
- 安装的是旧版本的 Node.js
- 部署服务的 Node 版本设置和你的电脑不一样
🔧 试试这样做
- 用 node -v 查看你的版本
- 按照报错里写的版本(Expected)重新安装 Node.js(推荐用 nvm)
- 部署服务设置里的 Node 版本也改成一样的
🤖 这样问 AI
出现了下面这样 Node 版本不匹配的报错。我的电脑是 [Mac/Windows]。请告诉我怎么换成需要的版本,以及怎么把部署环境的版本也调成一样。 [在这里粘贴完整的报错]
把 [ ] 部分换成你的实际情况,报错前后的几行也尽量一起复制粘贴。
相关术语
同一分类的其他报错
- 找不到模块
Module not found: Can't resolve - 找不到命令
command not found - 包版本冲突(ERESOLVE)
npm ERR! ERESOLVE unable to resolve dependency tree - 端口已被占用
EADDRINUSE: address already in use - 类型不匹配(TypeScript)
Type 'X' is not assignable to type 'Y' - 没有权限,安装不了(EACCES)
EACCES: permission denied - 内存不足(heap out of memory)
JavaScript heap out of memory - 不能使用 import 语句(模块设置)
SyntaxError: Cannot use import statement outside a module - 代码检查(ESLint)没通过,构建失败
Failed to compile — ESLint errors - 找不到文件或文件夹(ENOENT)
ENOENT: no such file or directory