Mainly, the issue was node-gyp. Node-gyp is a command-line tool written in Node.js for compiling addon modules for Node.js. It bundles Chrome’s team’s gyp project, which helps with cross-platform issues. Alas, the tool itself ended up causing its own issues!
For me, there are two problem:
- It does not support Python 3.
- It needs make – a build automation tool – with its variable CXX set to proper C/C++ compiler toolchain.
In my case, my system’s default Python is 3 and the CXX is not always set to the right toolchain. So, first remove the local directory’s node_modules folder if you did a failed npm install earlier, then input this in the command line:
CXX=c++ npm install –python=python2.7
Most node-gyp rebuild error should disappear!