Yarn Install failing with build error on macOS

Apr 25, 2021

I typically jump around my ChromeOS and MacOS machines on a daily basis while I code. Today, I got an error which I've never seen before and it looked like this:

make: *** [Release/obj.target/binding/src/binding.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/project_folder/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (node:events:365:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Darwin 20.3.0

And it was baffling me quite a bit. After a conversation with a good friend as well as some digging, we eventually found this StackOverflow post which helped us figure out what was going on. Essentially what we deduced is that I had previously upgraded NodeJS and the core libraries are now pointing to a newer version of C++. So to get around this, I had to specify a specific version of C++ version to go get this to work. So the workround was to run the following command:

rm -rf node_modules
rm yarn.lock
yard install -std=c++17


Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.