5

enter image description hereI used the command truffle unbox react to build a dapp. It is just the initial step of my dapp development. However, it sucks. It continually pops up

gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1

this error. I've already google this error. Therefore, I set my python default version at 2.7 and install visual studio 2015 and visual studio 2017. Also I've reinstall node-gyp and npm to make sure if it is the latest version. And also, npm install --global --production windows-build-tools I've tried whatever I can google. PLEASE HELP!

Majid joghataey
  • 1,488
  • 2
  • 17
  • 28
Jessie
  • 1,155
  • 3
  • 16
  • 27
  • Oh, I encoutered this one when fiddling with web3, if the npm windows-build-tools failed, try to open your VS2017, create a c++ console app build it and run it. Then restart your terminal and reinstall. Also I set the npm config npm config set msvs_version 2017 --global – keysl Sep 06 '19 at 01:48
  • @keys! Thanks for replying me. I've tried your solution, however it still not working. Did I misunderstand something? Can ```npm config``` be command individually? – Jessie Sep 06 '19 at 02:19
  • I've command ```npm config set msvs_version 2017 --global```, it ran smoothly. If I try ```npm config```, it gives me this error ```npm ERR! Usage:``` – Jessie Sep 06 '19 at 02:23
  • your right you just need to run npm config set msvs_version 2017 --global – keysl Sep 06 '19 at 02:24
  • just to make sure? are you running the cmd as administrator? – keysl Sep 06 '19 at 02:25
  • @keys! Yes, I am. I am running under windows environment. – Jessie Sep 06 '19 at 02:27
  • hmmm that's weird, maybe node-gyp is corrupted or something. dumb advice, have you tried reinstalling it? – keysl Sep 06 '19 at 02:31
  • @keys! Yes, I've tried it several times. This error makes me wonder if I have to build this dapp under Linux environment. Does this move make my dapp build smoother? – Jessie Sep 06 '19 at 02:35
  • Build Tools for VS2017 is different from VS2017 IDE. The error message indicates you're using build Tools, please make sure you've met all requirements according to this [document](https://github.com/nodejs/node-gyp#on-windows). – LoLance Sep 06 '19 at 06:56
  • @LanceLi-MSFT Really appreciate for replying me. I've install both Build Tools for VS2017 and also VS2017 community. What do you mean? Please be more specific. – Jessie Sep 06 '19 at 07:07
  • @LanceLi-MSFT Maybe I failed to install C++ workload. I don't know where the package is. How can I install it? Please help. – Jessie Sep 06 '19 at 07:21
  • You can follow [this issue](https://stackoverflow.com/a/57492119/10910450) to check if you've installed C++ workload, but if this issue occurs though you've configured the build tools well, I think this issue results from node.js version or what, which I'm not familiar with :( – LoLance Sep 06 '19 at 07:32
  • @LanceLi-MSFT Is ```Desktop Development with C++``` the C++ workload package that you have mention above? – Jessie Sep 06 '19 at 07:34
  • Now, I've installed Visual c++ Build tools. However, it still pops up the same error. What can I do to solve this error? I feel really hopeless right now. Please help! – Jessie Sep 06 '19 at 10:35

1 Answers1

3

I also had this problem, And finally I didn't realize what was going on.

but

my problem was solved that way

I uninstall node 12.14.1 and install 10.18.1 It's working now.

Majid joghataey
  • 1,488
  • 2
  • 17
  • 28
  • 1
    I faced the same problem on Node 13 on Windows 10. Uninstalled Node 13 and installed 11.6 and now it works for me too, thanks – user5305519 Feb 12 '20 at 04:00
  • 2
    I can't see how this could be a valid solution when you need to run also modules that require more recent version of npm – Decagrog Oct 13 '20 at 10:37
  • @ِِDecagrog I guess the packages we use are in accordance with the version of node that was released at the time And often not all packages are updated at node speed – Majid joghataey Oct 13 '20 at 11:04