Jasmine Vickery

Jasmine Vickery

Fix error: The engine node is incompatible with this module

I ran into this error when I was working through the nextjs blog tutorial while trying to switch over from npm to yarn.

Console output after running yarn install:

$ yarn install 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 "13.7.0"
$ error Found incompatible module.

For some reason I thought this meant that I had some kind of dependency conflict in my package.json.

Peering at it I couldn't see anything that looked like it was on a '13.7.0' version or might conflict with anything.

I had just upgraded my version of yarn earlier that day so I was worried I had a version with a bug in it.

After a brief spate of internet searching I realised it might be an issue with the version of node I was running.

Sure enough, when I ran node -v I got "13.7.0".

I updated it to 15.0.1 since I saw it was what the nextjs project had installed for @types/node and the next time I ran yarn everything worked.

Still not sure why this issue occurred with yarn and worked without any issues for npm. 🤷🏽‍♀️