numpy), when I got the following exception:
# Executing the following command... $ npm install numjs --save # resulted in ... gyp ERR! UNCAUGHT EXCEPTION gyp ERR! stack Error: spawn EACCES gyp ERR! stack at exports._errnoException (util.js:1028:11) gyp ERR! stack at ChildProcess.spawn (internal/child_process.js:313:11) gyp ERR! stack at exports.spawn (child_process.js:387:9) gyp ERR! stack at PythonFinder.exports.execFile (child_process.js:148:15) gyp ERR! stack at PythonFinder.checkPythonVersion
For those unfamiliar with
node-gyp, this is node's default way of building native Node addons.
Node native addons are:
In simpler terms, our library, or any of its dependencies tried to build a native addon, and the native build tool failed with the aforementioned exception. Turns out,
node-gyp is pretty strict about the version of Python running on your machine. It requires Python 2.7, while it might be that you are running Python 3 already, or have multiple ones that you are alternating between (as in my case).
I solved my particular problem by applying a
--python=<PATH_TO_PYTHON2_EXECUTABLE> parameter to the
npm install command:
$ npm install numjs --save --python=<PATH_TO_PYTHON2_EXECUTABLE>
To make the changes persistent, however, the documentation suggests to add the python version to the module configuration:
$ npm config set python <PATH_TO_PYTHON2_EXECUTABLE>
or add it to the