🐞 Node FFI Issues: node-gyp failed to install


While working on some Javascriptey stuff, your library or solution requires you to use something written in C or C++. Easy peasy, just install ffi using the package manager and declare victory 🎉.

npm i ffi -D

Not so fast (read slowly, yeah try again with the playback speed of 0.25)

Scrolling past the giant list of WARN, a small ERROR greets you 😕.

node-gyp failed to install 🙀.

There could be 101 reasons for that node-gyp error ?

A few google search and failed attempts later….âģ

You find that its due to the python version. https://github.com/libxmljs/libxmljs/issues/469

Node gyp build process uses python 2.7 ðŸĪŠ. So, then you just use your trusty anaconda (or virtualenv) and create a new environment with Python 2.7.

conda create -n py27 python=2.7
conda activate py27
# and now continue with your npm install thingie...ðŸ‘ĻðŸ―â€ðŸ’ŧ

See also