how to solve this error jest-worker@27.0.0-next.5:The engine "node" is incompatible with this module

Viewed 4981
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$ 
2 Answers

You should be able to fix the problem by updating node.

for Windows:

just reinstall node from the .msi in Windows from here.

for Ubuntu or Linux/Mac:

  • install module n to makes version-management easy:

sudo npm install n -g

  • For the latest stable version:

sudo n stable

  • For the latest version:

sudo n latest

In my case, I had snuck in a apt update in my Dockerfile, which makes the system aware of the update. It's best practice to keep versions strict. For example using 'packageName': '1.0.0' instead of 'packageName':'latest'

I was able to solve, by removing the apk update and also upgrading my version of node:alpine to node:alpine3.13.

Related