微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何解决这个错误 jest-worker@27.0.0-next.5:The engine "node" is incompatible with this module

如何解决如何解决这个错误 jest-worker@27.0.0-next.5:The engine "node" is incompatible with this module

linix@linix-HP-ProBook-6475b:~/projects/builds$ npx create-next-app hellochat
npx: installed 1 in 2.333s
Creating a new Next.js app in /home/linix/projects/builds/hellochat.

Installing react,react-dom,and next using yarn...

yarn add v1.22.10
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
error jest-worker@27.0.0-next.5: The engine "node" is incompatible with this module. Expected version "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0". Got "14.5.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom next --cwd /home/linix/projects/builds/hellochat has Failed.

linix@linix-HP-ProBook-6475b:~/projects/builds$ 

解决方法

您应该能够通过更新节点来解决问题。

对于 Windows:

只需从 here 的 Windows 中的 .msi 重新安装节点。

对于 Ubuntu 或 Linux/Mac:

  • 安装模块 n 以简化版本管理:

sudo npm install n -g

  • 对于最新的稳定版本:

sudo n stable

  • 对于最新版本:

sudo n latest

,

就我而言,我在我的 Dockerfile 中偷偷加入了一个 apt update,它让系统知道更新。最好的做法是保持严格的版本。例如使用 'packageName': '1.0.0' 而不是 'packageName':'latest'

我能够通过删除 apk update 并将我的 node:alpine 版本升级到 node:alpine3.13 来解决。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。