gyp error message during npm install

Today I read a nice tutorial online about Nuxt and Forestry.io. It came with a demo inside a Github repo and I cloned and tried to install it locally on my Mac.

During npm install however, I got this error

gyp: No Xcode or CLT version detected.

The error hinted to visit the node-gyp project on Github and looking a bit further, I arrived at the node-gyp issue specifically for Mac OS 10.15 (Catalina).

Here it became clear that I had to install node-gyp v7 globally and more importantly, run npm with an environment variable to tell it where to find node-gyp.

Since I always tend to forget this kind of fixes, I describe it here for my future self. Perhaps it will help some others too!

Start by installing node-gyp

sudo npm install -g node-gyp

node-gyp was installed in /usr/local/bin/node-gyp which is a soft link to the executable in /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js.

And then run the npm install command again, but accompanied by this environment variable

npm_config_node_gyp=/usr/local/bin/node-gyp npm install

This made it work for me!

Photo by Alexandre Debiève on Unsplash


Mijn Twitter profiel Mijn Facebook profiel
Pim Hooghiemstra Webdeveloper and founder of PLint-sites. Loves to build complex webapplications using Vue and Laravel! Latest post
Choosing our tech stack for a new project

Leave a Reply

Your email address will not be published. Required fields are marked *