Error with platform toolset while installing npm package using node-gyp

Hello everyone, I’m currently facing a frustrating issue while trying to install an npm package on my Windows 10 system. I’m setting up an Electron app with React but I’m constantly encountering a node-gyp error.

Here’s what I’ve attempted so far:

  • Uninstalled Node.js and installed the latest version available.
  • Tried various --msvs_version flags, including 2010, 2012, 2013, and 2015.
  • Completely deleted the .node-gyp folder.
  • Configured the Python path in .npmrc: python=C:\Python27\python.exe.
  • Updated npm using npm -g install npm@next.
  • Manually ran node-gyp configure and node-gyp rebuild.

The major error message during npm install is as follows:

error MSB8008: Specified platform toolset (v120) is not installed or invalid
msbuild failed with exit code: 1
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! node -v v6.10.0
gyp ERR! node-gyp -v v3.5.0

And when I run node-gyp rebuild directly, I get this message:

gyp: binding.gyp not found while trying to load binding.gyp

As I’m quite new to handling these build toolchains, I’m not sure what the next steps should be. I would really appreciate any suggestions or insights to help resolve this issue!

I ran into something very similar last year when working on an Electron project. The v120 toolset error drove me crazy for days until I realized the issue was with conflicting Visual Studio installations on my machine. What finally worked for me was completely removing all Visual Studio components through Programs and Features, then doing a clean install of Visual Studio Build Tools 2017 or later. The key thing I learned is that node-gyp gets confused when multiple toolset versions are present. After the clean install, I set the npm config with npm config set msvs_version 2017 and everything compiled smoothly. Also worth noting that some packages have specific toolset requirements in their package.json, so check if the package you’re installing has any documented build requirements. The Python path configuration looks correct, so I suspect it’s purely a Visual Studio toolset issue.

ah this is a classic windows build tools nightmare! sounds like you dont have the right visual studio build tools installed. try running npm install --global windows-build-tools as administrator - it should grab everything you need automaticaly. also make sure your using the right node/npm combo, sometimes mixing versions causes wierd toolset errors like v120.

The v120 toolset error indicates you need Visual Studio 2013 build tools specifically, but there’s likely a version mismatch happening. Since you’re on Windows 10 with Node v6.10.0, I’d recommend upgrading to a more recent Node version first - that older version has known compatibility issues with newer Windows builds. Before installing packages, run npm config set msvs_version 2015 and ensure you have Visual Studio 2015 Build Tools installed rather than mixing different versions. The binding.gyp error when running node-gyp directly is normal since you need to be in a directory with that file present. Focus on getting the toolset sorted first and the npm install should work properly.