I am currently working on a nodejs web application I am having trouble pushing the application online with cloud foundry. I did some research on the errors and it seems that
Delete the ~/.node-gyp folder and then the ~/.npmrc file.
Reboot your server and rerun npm install in your project folder
Edit:
Warning: removing ~/.npmrc will delete your other configurations
It worked after deleting
package-lock.jsonand re runnpm installIf you are using yarn to build your program delete
yarn.lockand re runyarn install
Figured out the issue. Some of the npm packages were not up to date. I modified the package.json to install all the latest versions of all packages and the error was fixed.
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.
Follow these steps to resolve the issue.
Source: https://codeforgeek.com/make-failed-with-exit-code-2/