A tale from Node.js Multi Compiler problems



We all know that, different platform, different behavior.
No matter what you use, if it is OS X, Debian, Arch Linux, RHEL or Windows, there are some common problems for specific platforms, let's handle a simple one, multiple compilers/language versions on different Systems, that are going to confuse npm.

So let's start solve this really small problems!


On Windows you are probably going to run into errors, if you want to use native extensions and you're developing native Software and thus you have many compiler versions of msvc and gcc installed.

For most of the time node will be able to detect the compiler you've installed, but for some Versions or if you have got installed multiple Versions, e.g. VS2012, VS2003, ..., of different compilers, you may run into this error.

MSBUILD : error MSB3411

The error is telling you, that you don't have a compiler installed and can't find VCBuild.exe.

To fix this you can simply append --msvs_version=xxxx

One example, if you have got Microsoft Visual Studio 2012 installed, the following will fix your problem.

npm install --msvs_version=2012


When using a GNU/Linux OS, for example Arch Linux you will run at least with Arch Linux in a conflict with Python 3 when gyp is used for compiling native extensions.

This problem occurs, because some GNU/Linux Distributions may set the newer Python 3 as default executable. To fix this you do not need to touch your System and also you shouldn't alter your System just to make a single Application work...

Instead, you're going to do this:

npm install --python=python2.7

Or a more persistent way, so you wont run into this trouble again:

npm config set python python2.7