Node-sass: MSBUILD error

Created on 23 Aug 2017  路  17Comments  路  Source: sass/node-sass

I have tried the troubleshooting steps for installing node-sass. But it did not work fine. It did not installed the node-sass and generated the npm.err and npm.log files.
The log file is attached.
npm_log.txt
How can it be solved?

CLOSE - Issue template ignored

Most helpful comment

Install all the required tools and configurations using Microsoft's windows-build-tools by running npm install -g windows-build-tools from an elevated PowerShell (run as Administrator).

It takes a while.

Then run npm config set msvs_version 2015 -g

sorted the issue for me

All 17 comments

Long contents

> [email protected] install C:\DCDx\test\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.3/win32-x64-48_binding.node

> [email protected] postinstall C:\DCDx\test\node_modules\node-sass
> node scripts/build.js

Building: C:\Program Files\nodejs\node.exe C:\DCDx\test\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 8/23/2017 2:31:46 PM.
Project "C:\DCDx\test\node_modules\node-sass\build\binding.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Release|x64".
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere.  [C:\DCDx\test\node_modules\node-sass\build\binding.sln]
Done Building Project "C:\DCDx\test\node_modules\node-sass\build\binding.sln" (default targets) -- FAILED.

Build FAILED.

"C:\DCDx\test\node_modules\node-sass\build\binding.sln" (default target) (1) ->
(_src_\libsass target) -> 
  MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere.  [C:\DCDx\test\node_modules\node-sass\build\binding.sln]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.53

What npm command did you run?

@xzyfer npm install -ddd node-sass > npm.log 2> npm.err

Something is wrong with Visual Studio installation, vcbuild is a pretty old thing.

Please follow the refer to the minimum requirements for node-gyp as in our README https://github.com/nodejs/node-gyp#on-windows
You should be able to just download our precompiled binaries. If you had an issue with that, that is also covered in our TROUBLESHOOTING guide.

Install all the required tools and configurations using Microsoft's windows-build-tools by running npm install -g windows-build-tools from an elevated PowerShell (run as Administrator).

It takes a while.

Then run npm config set msvs_version 2015 -g

sorted the issue for me

@garhbod work like the charm .
this line enough
npm install -g windows-build-tools
.
.

rtertret

@garhbod Thanks a lot, that helped

@garhbod Man, you just save a life ! Spent many hours and after that I found your fix and worked like a charm ! (y)

@garhbod Worked for me, No need for Visual Studio. This has what you need:

npm install --global --production windows-build-tools

Thanks!

I ran into the exact same issue that the original post reported. The fix suggested above by garhbod and confirmed by many others did not work for me. npm install -g windows-build-tools was always hanging.

I finally managed to get it working by downgrading Node.js from the version 10 branch to the version 8 branch.

@gsidler it was hanging here too (npm version 6.1.0, node version 8.11.2), but as npm install -g windows-build-tools stopped logging (logs to file C:\Users\MyUserName.windows-build-tools\build-tools-log.txt ) I just hit ctrl-c to terminate and after running npm config set msvs_version 2015 -g I could successfully run npm install, which in turn wants to compile (...)\node_modules\node-sass\build\binding.sln

Same thing happened to me on same versions as @andersand - his suggestion to run npm config set msvs_version 2015 -g worked. I was able to do npm install after that.

@garhbod Thanks! It worked.

nice one @garhbod

An additional step that might prevent further problems is that you should run the npm install for your project in an elevated PowerShell (I usually just do it from the terminal in VSC - which lacks permissions). Thanks @garhbod.

npm install -g windows-build-tools works total fine, but at some cases where there can be restriction on administration permission the below command saves the effort

npm install --unsafe-perm node-sass

Was this page helpful?
0 / 5 - 0 ratings

Related issues

goseesomething picture goseesomething  路  3Comments

samayo picture samayo  路  3Comments

liuyuqiang picture liuyuqiang  路  3Comments

primiano picture primiano  路  3Comments

nagyfej picture nagyfej  路  3Comments