Skip to content

Windows 10: The build tools for v120 (Platform Toolset = 'v120') cannot be found. #679

Closed

Description

@nerijusgood

When installing package via NPM some module had dependency that fired node-gyp rebuild which spawns tons of errors:

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(57,5): error MSB8020: The build t
ools for v120 (Platform Toolset = 'v120') cannot be found. To build using the v120 build tools, please install v120 bui
ld tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-cli
ck the solution, and then selecting "Retarget solution". [C:\Users\nerij\Projects\react-browserify-cli\node_modules\bro
wser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modul
es\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:\Users\nerij\Projects\react-browserify-cli\node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
npm WARN optional dep failed, continuing bufferutil@1.1.0
npm WARN optional dep failed, continuing utf-8-validate@1.1.0

This is part of install which gets errors. I fallowed instruction on node-gyp install, however Windows 10 does not allow instal Windows 7 SDKs (I found and installed Windows 10 SDKs, with no efefct). Anyone had same issues?

Activity

  1. perok commented on Aug 4, 2015

    @perok

    Have you installed visual studio 2015 with visual C++? That helped for me.

  2. nerijusgood commented on Aug 5, 2015

    @nerijusgood
    Author

    The above error is with MVS 2015 C++. Could not do anything here so I completely removed MVS 2015 and installed 2013 C++.

    Now it seems to have different error. The error is with too long path names (opened case in stack overflow, since its not node-gyp fault): http://stackoverflow.com/questions/31817447/windows-10-node-gyp-cannot-build-msbuild-failed-with-exit-code-1

    Any ideas?

  3. BlackGlory commented on Aug 8, 2015

    @BlackGlory

    I have same problem in Windows 10 with VS2015&SDK.
    :-(

  4. axefrog commented on Aug 14, 2015

    @axefrog

    If there were a +1 button, I'd be clicking it myself right now, but there's not, so I'm forced to pollute your issue with my comment. Please accept my humblest apologies. Windows 10 user. VS2015 and VS2013 both installed, and both with C++. utf-8-validate is the offender in my case too.

  5. musm commented on Aug 14, 2015

    @musm

    I'm having problems with Windows 10. VS2015 community installed. I get the following error

    Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
    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.   
    
  6. axefrog commented on Aug 14, 2015

    @axefrog

    Guys, this worked for me; add GYP_MSVS_VERSION=2013 to your user environment variables.
    i.e. right-click start -> system -> advanced system settings -> environment variables -> "user variables for [username]" -> new
    Make sure you open a new console after doing this, so that the environment variable addition is picked up.

  7. uxfed commented on Aug 16, 2015

    @uxfed

    @axefrog Thank you!!!!!!

    With Windows 8.1 and VS2015 SDK/C++ installed I had to use:

    GYP_MSVS_VERSION=2015

    (so change the version to what you're using)

  8. jasonwilliams commented on Aug 18, 2015

    @jasonwilliams
    Contributor

    BTW what SDK are people using?
    Im still using the one from the readme, if anyone gets this working on Windows 10 i would be ever so grateful if you could write a walkrthough, step by step guide. I've been struggling with this for the past few days now

    @pjquinn I now get this error instead:

    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\CodeAnalysis\Microsoft.CodeAnalysis.targets(214,5): error MSB4175: The task fac
    tory "CodeTaskFactory" could not be loaded from the assembly "C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Build.Tasks.v12.0.dll". Cou
    ld not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Build.Tasks.v12.0.dll' or one of its dependencies.
    The system cannot find the file specified.
    

    Can anyone help? :(

  9. uxfed commented on Aug 18, 2015

    @uxfed

    Maybe try VS2015 w/ C++ and set env variable: GYP_MSVS_VERSION=2015

    I'm on win 8.1 though, not 10

  10. jasonwilliams commented on Aug 23, 2015

    @jasonwilliams
    Contributor

    @pjquinn that didn't work for me :-(

  11. uxfed commented on Aug 24, 2015

    @uxfed

    @Jayflux I also ended up installing beta npm@3 (using 3.3.0 currently), I'm not sure which of the above finally made it work, but it does now, at least on Win 8.1

  12. jasonwilliams commented on Aug 24, 2015

    @jasonwilliams
    Contributor

    @pjquinn finally got it working by uninstalling Visual Studio 2015 and installing 2013, then i ran

    set GYP_MSVS_VERSION=2013
    npm install --msvs_version=2013
    

    So 2013 deffo works on windows 10, not sure why 2015 fails

  13. zhaoyao91 commented on Aug 25, 2015

    @zhaoyao91

    @Jayflux what version of window, vs, and sdk are you using now?

  14. jasonwilliams commented on Aug 26, 2015

    @jasonwilliams
    Contributor

    @zhaoyao91
    Windows 10
    Visual Studio 2013
    I have both SDK 7.1 and SDK 10 installed, I think its using 10 (any way for me to confirm this)?
    set GYP_MSVS_VERSION=2013
    npm install --msvs_version=2013

  15. 42 remaining items

  16. hungcao181 commented on Oct 10, 2016

    @hungcao181

    These official guidelines resolved my problem:

    https://github.com/nodejs/node-gyp#installation
    https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#resolving-common-issues

    For the summary, Properly install of Python2.7, C++ build tools, then walk through Resolving common issues section on the Microsoft's nodejs guideline should help.

  17. NicolasDorier commented on Jun 7, 2017

    @NicolasDorier

    My problem was the MSBuild pointed by the PATH environment variable was not the expected version.

    Correct one is "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" (Visual Studio 2015 build tools installed)

    msbuild -version
    
    Microsoft (R) Build Engine version 14.0.25420.1
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    14.0.25420.1
    

    Ran again npm install, and worked like a charm.

  18. ira-hart commented on Jun 8, 2017

    @ira-hart

    The fix for me was to do this in Microsoft Visual Studio 2017:
    project -> Retarget_solution
    Platform toolset

    and then:

    project -> Retarget_solution
    Windows SDK version

    After that, it built with no issues.

  19. crazysal commented on Jun 9, 2017

    @crazysal

    https://www.npmjs.com/package/windows-build-tools

    npm install --global windows-build-tools

    Installs all dependencies as needed

  20. saper commented on Aug 17, 2017

    @saper
    Contributor

    I believe this can be closed now.

    In general the recommendation is always to use the same PlatformToolset for addons and for the node engine itself. This means the same compiler should be used to build node and addons.

    Older versions of node were built with VS2013, since 6.3.0 I think VS2015 is used.

  21. self-assigned this
    on Aug 17, 2017
  22. gibfahn commented on Aug 19, 2017

    @gibfahn
    Member

    In general the recommendation is always to use the same PlatformToolset for addons and for the node engine itself. This means the same compiler should be used to build node and addons.

    Doesn't this mean in effect we only support building native modules on Windows with one version of Visual Studio?

  23. saper commented on Aug 19, 2017

    @saper
    Contributor

    one should not mix, currently node binaries from nodejs.org are built with VS2015 and PlatformToolkit v140. But one can easily build node yourself with own version of VisualStudio and build modules as needed.

  24. happygrizzly commented on Nov 2, 2018

    @happygrizzly

    node-gyp: v3.4.0
    Windows 10 and full VS2013 and VS2015 installed (tried on 2 machines).
    Setting --msvs_version=2015 and GYP_MSVS_VERSION=2015 does not help.
    Only after changing PATH it seems to work:
    set PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%

    for using vs2013 it's required the similar :
    set PATH=C:\Program Files (x86)\MSBuild\12.0\Bin;%PATH%

    how the hell should I understand which VC++ version a package require? Why node-gyp's script can not declare it?! Why node-gyp can find a working VC++ version on machine?
    that's all simply terrible.

    This is twice as terrible if you don't have admin rights (installations are possible yet it might take a long time to be done) due to some corporative standards)))))

  25. rvagg commented on Jun 20, 2019

    @rvagg
    Member

    closing due to staleness, windows support has evolved somewhat since this was opened, please open a new issue if there's a new specific thing that can be discussed

  26. ashish314 commented on May 18, 2021

    @ashish314

    I had this similar issue on windows 10 and node 11, npm install was failing due to node-gyp rebuild command was unable to complete. I tried every solution i could find including installing mvs 2015, python 2.7 nothing worked.
    Then i tried with latest node version i.e 16 and used git bash(terminal) instead of windows cmd and i don't know how but it worked. At this point i have mvs verion 2019 and 2015 installed and mvs version 2019 set in npm config.
    Hope this helps..!!

  27. davidalbertonogueira commented on Jun 27, 2022

    @davidalbertonogueira

    What's the proper way to install node-gyp in 2022?
    I'm doing npm install in https://github.com/creativetimofficial/impact-design-system/ , and I get errors pointing to this library. The error states that I have version3, but npm ls -g says that I have version9.

    Links: creativetimofficial/impact-design-system#24
    Latest issue that I oppened : #2688 (#2688)

  28. cclauss commented on Jun 27, 2022

    @cclauss
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions