Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0". #60

Open
javruben opened this issue Feb 12, 2014 · 41 comments

Comments

@javruben
Copy link

When running npm install pty.js on windows I get:

C:\cygwin\opts\newclient\node_modules\pty.js>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0".
gypnpm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the pty.js package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls pty.js
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "pty.js"
npm ERR! cwd C:\cygwin\opts\newclient
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE

I have installed winpty, but apparently I'm missing some tools. What do I need more?

@AndrewGrachov
Copy link

Install a visual studio express 2013(desktop with c++ redist), this will help

@gregorymachon
Copy link

Thanks! It helped!

@simonfanz
Copy link

Surely a whole 8GB of IDE aren't needed just to get this working? Is there not a smaller option?

@AndrewGrachov
Copy link

You can try also
Microsoft build tools
teh standalone package,

But a general recomendation - use mac or ubuntu :)

@juancancela
Copy link

Sadly installing Microsoft Build Tools (as mentioned on previous message) wont work, since it installs "12.0". Basically, you'll get something like this: MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "12.0", "4.0".
I used Linux all my life, but due to a Xamarin project im working on, i needed to switch to windows. This is hell. None of my NodeJs projects are working, and the only error im getting is the previous one.
Do you think is there any chance to allow using 4.0 and 12.0 with gyp?

@mix3d
Copy link

mix3d commented May 15, 2015

I'm having the exact same problem. Tried to get version 2, got version 12.

@Martinspire
Copy link

Got this as well. Not sure if it has to do with either Windows 10 or Visual Studio RC 2015

@bchintx
Copy link

bchintx commented Jul 23, 2015

I was getting the same error as reported above. Installing the Microsoft Build Tools 2013 from the above links didn't work for me either. It only installed version 12.0, so I still received an error re: version 2.0.
Fortunately, its working now after I upgraded Node to the latest build (12.7). I was running 10.38 before.

@TNT-Likely
Copy link

i have the same problem,when i intsall msbt 2013,it doen't work .

how do you reslove?

@TNT-Likely
Copy link

@bchintx

@TNT-Likely
Copy link

@javruben @nicolasximenes

@shawmanz32na
Copy link

I can also attest to this error. On Windows 10 x64, I see MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "12.0", "14.0", "4.0". Installing the latest msbuild toolkits got me the 12.0 and 14.0 options. Looking at my Windows/Microsoft.Net folder, it looks like I have every 32 bit .NET version known to man, but only .NET 4 in 64 bit. Maybe that could help lead to a solution?

@TNT-Likely
Copy link

thanks,i reslove it by add --msvs_version=2013 . @shawmanz32na

@shawmanz32na
Copy link

@TNT-Likely Where did you add the --msvs_version switch? I'm encountering this error way down the chain of a yeoman generation, and don't know where I can specify the switch...

@shawmanz32na
Copy link

For those of us following along that are encountering this error deep down in an NPM call, you can use npm config set msvs_version 2012 --global to tell NPM to always use a different MSVS version. Thanks goes to http://stackoverflow.com/a/22411007/1342760

@joinee0208
Copy link

good

@wzup
Copy link

wzup commented Nov 16, 2016

@TNT-Likely

i reslove it by add --msvs_version=2013

Where did you add it to? To your morning smoothie? Express your ideas more precise, please

@wzup
Copy link

wzup commented Nov 16, 2016

@shawmanz32na

Didn't work for me

error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found.

@mokanfar
Copy link

mokanfar commented Mar 4, 2017

open up a new cmd as administrator and run this command:
npm install --global --production windows-build-tools
then
npm config set msvs_version 2015 --global
close all instances of shell/cmd, reopen a cmd (regular this time, non-administrator) return to your directory where you are trying to run npm install and run it again

@joeyespo
Copy link

joeyespo commented Oct 30, 2017

For anyone using Yarn, the above comment worked for me after running the same command with Yarn.

So, for anyone skimming:

$ npm install --global --production windows-build-tools
$ yarn config set msvs_version 2015 --global

@ramzgt
Copy link

ramzgt commented Feb 22, 2018

thank you all

@h3nn3
Copy link

h3nn3 commented Mar 6, 2018

wow saved my day! Thanks

@AmmarAshfaq
Copy link

Thanks All Of you for save my day

@mohammedPoolwala
Copy link

Thanks All

@anvarknian
Copy link

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

@GuiRitter
Copy link

GuiRitter commented Aug 7, 2018

@mokanfar 's comment helped to fix one error, but another showed up:

... fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory (compiling source file ..\src\CanvasGradient.cc) ...

EDIT: fixed by doing a manual install.

@rafadastan
Copy link

Open cmd with administrator and write this command: npm install --global --production windows-build-tools

@mike-seekwell
Copy link

If you're seeing this in 2019, you may need

npm config set msvs_version 2017

@mamboer
Copy link

mamboer commented Apr 23, 2019

@mike-seekwell 👍Niubility!

@wszwr003
Copy link

wszwr003 commented May 9, 2019

thank you all

@xyzdata
Copy link

xyzdata commented May 15, 2019

Q:

MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0".

# Operating System: Windows 10 Pro 64-bit (10.0, Build 17134) (17134.rs4_release.180410-1804)
$ npm i

image

A:

$ npm -h
$ npm help config 
$ npm config list
$ npm config ls -l

OK

???

Error

## not work at all???
$ npm config set msvs_version 2017

image

## ???
$ npm install --global --production windows-build-tools
$ npm config set msvs_version 2012 --global
# ???
$ npm config set msvs_version 2012

$ npm config list -l

$ npm config list --json

@ghost
Copy link

ghost commented Jun 6, 2019

For anyone, who see this error and did not find solution. I found solution for my project.
I has node.js 12.x installed via Chocolatey. I uninstalled node.js version 12.x and installed node.js version 10.x from the installer at the official site.

@profet23
Copy link

profet23 commented Jul 5, 2019

For anyone, who see this error and did not find solution. I found solution for my project.
I has node.js 12.x installed via Chocolatey. I uninstalled node.js version 12.x and installed node.js version 10.x from the installer at the official site.

@NeliHarbuzava thank you so much. Saved me a lot of time.

I uninstalled nodejs via chocolatey and then installed the https://chocolatey.org/packages/nodejs-lts package instead (long term support) which is version 10.x.

👍 ❤️

@kgrajan12
Copy link

in my case

Q:

MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0".

# Operating System: Windows 10 Pro 64-bit (10.0, Build 17134) (17134.rs4_release.180410-1804)
$ npm i

image

A:

$ npm -h
$ npm help config 
$ npm config list
$ npm config ls -l

OK

???

Error

## not work at all???
$ npm config set msvs_version 2017

image

## ???
$ npm install --global --production windows-build-tools
$ npm config set msvs_version 2012 --global
# ???
$ npm config set msvs_version 2012
$ npm config list -l

$ npm config list --json

I resolved this problem.
In my case the same problem.
I just delete node_modules
then install dependencies one by one
if you got any error open that particular dependency in npm website you have a problem in node js version
you can follow the instruction in that it will work.

@LucaciuRaul
Copy link

Just open a CMD window in Administrator mode and type "npm install --global windows-build-tools --vs2015". This will install Build Tools 2015 version, implicitly what you need. It worked for me.

@erickthered
Copy link

I was able to compile it by running (as administrator):

npm install --global windows-build-tools
npm config set msvs_version 2017 --global

and then performing the usual steps as a regular user.

@unruledboy
Copy link

I was able to compile it by running (as administrator):

npm install --global windows-build-tools
npm config set msvs_version 2017 --global

and then performing the usual steps as a regular user.

life saver!!!

@Agricola-a
Copy link

I solved like this: having to open an old 2019 project. I was using node version 14.18.0, I went back to v12.0.0 using nvm for windows (when you do this you might have to empy the C:\Program Files\nodejs if you can't switch version with nvm) and this solved my problem. After that npm install worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests