abagshaw abagshaw - 3 months ago 35
Node.js Question

Is is possible to install sharp for node.js without python?

I am needing to install

sharp
for node.js https://github.com/lovell/sharp but it appears that one of its dependencies (libvips) needs python (and so installation fails as I don't have python on my system and don't expect I'll be able to use python in my production environment).

I read that on the
sharp
github page it states "OS X, Windows (x64), Linux (x64, ARM) systems do not require the installation of any external runtime dependencies." so I'm not sure why I need python.

Answer

The sharp package uses node-gyp, which is a tool for "compiling native addon modules for Node.js." Typically native means C or C++ libraries like libvips. Python 2.7 is required for node-gyp to work as explained in the install docs. Despite sharp coming with prebuilt binaries, it still requires node-gyp (for now) as explained in this issue.