Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

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

Closed
landon9720 opened this issue Jul 13, 2017 · 2 comments

Comments

@landon9720
Copy link

landon9720 commented Jul 13, 2017

I'm setting up Windows 10 running in VirtualBox 5.1 running in macOS Sierra. The intent is to create an environment where I can build and test my project in Windows. I get the above error when running npm i. Here's the full output of my use case:

C:\Users\lanku\src>git clone https://github.com/szwacz/electron-boilerplate.git
Cloning into 'electron-boilerplate'...
remote: Counting objects: 1748, done.
Receiving objects: 100% (1748/1748), 777.20 KiB | 869.00 KiB/s, don
Resolving deltas: 100% (1053/1053), done.


C:\Users\lanku\src>cd electron-boilerplate

C:\Users\lanku\src\electron-boilerplate>npm i
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.

> electron-chromedriver@1.7.1 install C:\Users\lanku\src\electron-boilerplate\node_modules\electron-chromedriver
> node ./download-chromedriver.js


> weak@1.0.1 install C:\Users\lanku\src\electron-boilerplate\node_modules\weak
> node-gyp rebuild


C:\Users\lanku\src\electron-boilerplate\node_modules\weak>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.
MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0".
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\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:258:23)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:197:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\lanku\src\electron-boilerplate\node_modules\weak
gyp ERR! node -v v8.1.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

> fsevents@1.1.2 install C:\Users\lanku\src\electron-boilerplate\node_modules\fsevents
> node install


> fcopy-pre-bundled@0.3.4 install C:\Users\lanku\src\electron-boilerplate\node_modules\fcopy-pre-bundled
> echo ''

''

> electron@1.6.11 postinstall C:\Users\lanku\src\electron-boilerplate\node_modules\electron
> node install.js


> electron-boilerplate@0.0.0 postinstall C:\Users\lanku\src\electron-boilerplate
> install-app-deps

⚠️  Please use as subcommand: electron-builder install-app-deps
electron-builder 19.16.0
No native production dependencies
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN ajv-keywords@2.1.0 requires a peer of ajv@>=5.0.0 but none was installed.
npm WARN electron-boilerplate@0.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: weak@1.0.1 (node_modules\weak):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: weak@1.0.1 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

added 850 packages in 145.682s

Here is some more info about my environment:

C:\Users\lanku\src\electron-boilerplate>node --version
v8.1.4

C:\Users\lanku\src\electron-boilerplate>code --version
1.14.0
b8cd5b9556d8b70ea560d35b903422363f6c5c40

(Please let me know what other information might be helpful.)

I would appreciate any help troubleshooting this issue.

Thanks for this great project! It has saved me countless hours or days getting my project off the ground.

L

@black-snow
Copy link
Contributor

black-snow commented Jul 13, 2017

Seems to be an issue with building weak.

This should fix your issue.

Not an electron-boilerplate issue.

@landon9720
Copy link
Author

Thank you. Globally installing https://www.npmjs.com/package/windows-build-tools did the trick.

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

No branches or pull requests

2 participants