GYP ERR! build error. stack Error: 'make' failed with exit code 2

It worked after deleting package-lock.json and re run npm install

If you are using yarn to build your program delete yarn.lock and re run yarn install


In our case (since make failed), this issue could be resolved by installing the build / development tools:

Ubuntu / Debian:

apt-get install -y build-essential

CentOS:

yum install gcc gcc-c++ make 

Fedora 23 and above:

dnf install @development-tools

If this is not the solution, you might want to try to upgrade or downgrade node, remove package-lock.json and the node_modules folder, and then re-run npm install.