Node-gyp errors when doing npm install

Hi. Been strugling with this a couple of hours. I’ve reinstalled most of the stuff just to try everything out. Even installed SDKs and MS studio, but nothing seems to fix this error.

npm = 3.3.0
node = 0.12.7

Anyone experienced the same or possible able to tip me in the right direction?

Here’s the error I get:

C:\xampp\htdocs\thetheme\wp-content\themes\thetheme\node_modules\bufferutil>if not defined npm_config_node_gyp (node “C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\…..\node_modules\node-gyp\bin\node-gyp.js” rebuild ) else (node rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the “/m” switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(54,5): error MSB8020: The build tools for Visual Studio 2012 (Platform Toolset = ‘v110’) cannot be found. To build using the v110 build tools, please install Visual Studio 2012 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting “Retarget solution”. [C:\xampp\htdocs\thetheme\wp-content\themes\thetheme\node_modules\bufferutil\build\bufferutil.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command “node” “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” “rebuild”
gyp ERR! cwd C:\xampp\htdocs\thetheme\wp-content\themes\thetheme\node_modules\bufferutil
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok
npm WARN install:bufferutil bufferutil@1.1.0 install: node-gyp rebuild
npm WARN install:bufferutil Exit status 1

utf-8-validate@1.1.0 install C:\xampp\htdocs\thetheme\wp-content\themes\thetheme\node_modules\utf-8-validate
node-gyp rebuild

C:\xampp\htdocs\thetheme\wp-content\themes\thetheme\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node “C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\…..\node_modules\node-gyp\bin\node-gyp.js” rebuild ) else (node rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the “/m” switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(54,5): error MSB8020: The build tools for Visual Studio 2012 (Platform Toolset = ‘v110’) cannot be found. To build using the v110 build tools, please install Visual Studio 2012 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting “Retarget solution”. [C:\xampp\htdocs\thetheme\wp-content\themes\thetheme\node_modules\utf-8-validate\build\validation.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command “node” “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” “rebuild”
gyp ERR! cwd C:\xampp\htdocs\thetheme\wp-content\themes\thetheme\node_modules\utf-8-validate
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok
npm WARN install:utf-8-validate utf-8-validate@1.1.0 install: node-gyp rebuild
npm WARN install:utf-8-validate Exit status 1

What have you done so far to try and fix your problems?

Have you read this sticky thread?

What version of MS Visual Studio did you install? You need to set the version in you npm command, i.e.

npm install --msvs_version={version}

Replace {version} with 2012, 2013 or 2015 depending on what you have installed. I’ve had the best luck with 2013.

You can set the version globally with

npm config set msvs_version {version}

@ben This is now fixed. I didn’t only uninstall node from “Remove Programs”, but also deleted all the leftover folder as a second try, also in the appdata folder. Reinstalled node-v0.12.7-x64.msi and everything seem to work. Case closed :slight_smile:

@Ken_Kimball I set the right version now, thanks for the tip. Don’t know if this fixed it, but what is done is done.

Glad you both helped. Have a nice day!

Just to update this issue. When I deleted the node_modules folder again, the problem is back. I’ve created an issue on node-gyp on GitHub, please have a look: https://github.com/nodejs/node-gyp/issues/703

The problem might be deeper than I thought (?).

How important is node-gyp for Roots Sage development? Do you guys think I’m correct regarding the file path issue?

Will nvm help me?

The problem isn’t related to node-gyp or Sage. This is an issue with your machine.