Search code examples
node.jsnpmyarnpkgnode-gyp

yarn install fails because node-gyp is looking for dated node version header


After upgrading to Node 18.12.0 (on macos Ventura 13.2.1) , I ran into issues with a failed yarn install, with the following error:

enter image description here

I have attempted:

  • Uninstalling and reinstalling Node, npm, and nvm on my machine
  • Wiping and recreating npm config But nothing works. I can't figure out where this value is set that's making node-gyp look for the headers for the outdated version of node, and manually setting a new tarball hasn't helped. The most likely cause of this was following the second answer on this SO thread(How to prevent node-gyp from downloading node-headers.tar.gz and node.lib from internet?), but not replacing the current Node version.

Solution

  • This was right in my face the entire time: it never occurred to me to check the Yarn config, which is where the outdated headers were living.