node-gyp can't find VCBuild.exe

Created on 28 Oct 2018  路  11Comments  路  Source: nodejs/node-gyp

  • Node Version:
    node v10.9.0
    npm 6.2.0

  • Platform:
    OS Name: Microsoft Windows 10 Pro
    OS Version: 10.0.16299 N/A Build 16299
    System Type: x64-based PC

  • Compiler:
    Microsoft (R) Build Engine version 14.0.25420.1
    Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24210 for x86

Verbose output (from npm or node-gyp):

>node-gyp build
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
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 Framew
ork 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it i
s installed elsewhere.  [c:\Users\Szymon Marczak\Desktop\demo\build\binding.sln]
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:\Users\Szymon Marczak\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:239:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Szymon Marczak\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build"
gyp ERR! cwd c:\Users\Szymon Marczak\Desktop\demo
gyp ERR! node -v v10.9.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok



I have tried:

  • [x] Installed Visual Studio Community 2017 and Build Tools
  • [x] npm install --global --production windows-build-tools
  • [x] npm config set msvs_version 2017
  • [x] Uninstalled everything (VS & Build Tools)
  • [x] Installed Build Tools only

and still fails.

Most helpful comment

@szmarczak please run node-gyp rebuild --verbose, this should print info about finding VS 2017 (including the Build Tools).

All 11 comments

For some cases running

node-gyp configure --msvs_version=2015

or setting:

set npm_config_msvs_version=2015

helps detect the right MSVS version (yes 2015, not 2017).

I tried running BT 2015, same problem. Where should be VCBuild.exe located?

Where should be VCBuild.exe located?

VCBuild.exe does not exist since VS2012 (IIRC). This is the output that MSbuild produces when node-gyp does not correctly recognize your MSVS version, and falls back to the oldest it knows.

That why I tought set npm_config_msvs_version=2015 would force node-gyp to consider VS2015 (which is similar enough to VS2017)

Thanks for letting me know. I really appreciate your help :) I'll give you more info tomorrow.

@szmarczak please run node-gyp rebuild --verbose, this should print info about finding VS 2017 (including the Build Tools).

@joaocgreis Calling node-gyp rebuild --verbose worked! Thanks <3

C:\Users\Szymon Marczak\Desktop\demo>node-gyp build
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Users\Szymon Marczak\Desktop\demo\build\addon.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.D
efault.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on
disk.
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:\Users\Szymon Marczak\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:239:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Szymon Marczak\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build"
gyp ERR! cwd C:\Users\Szymon Marczak\Desktop\demo
gyp ERR! node -v v10.9.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

C:\Users\Szymon Marczak\Desktop\demo>node-gyp rebuild --verbose
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\Users\\Szymon Marczak\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose' ]
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\Szymon Marczak\AppData\Roaming\npm\node_modules\node-gyp\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\Szymon Marczak\AppData\Roaming\npm\node_modules\node-gyp\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\Szymon Marczak\AppData\Roaming\npm\node_modules\node-gyp\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\Szymon Marczak\AppData\Roaming\npm\node_modules\node-gyp\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\Szymon Marczak\AppData\Roaming\npm\node_modules\node-gyp\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\Szymon Marczak\AppData\Roaming\npm\node_modules\node-gyp\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed  python2 { Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\Szymon Marczak\AppData\Roaming\npm\node_modules\node-gyp\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\Szymon Marczak\AppData\Roaming\npm\node_modules\node-gyp\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\Szymon Marczak\AppData\Roaming\npm\node_modules\node-gyp\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\Szymon Marczak\AppData\Roaming\npm\node_modules\node-gyp\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\Szymon Marczak\AppData\Roaming\npm\node_modules\node-gyp\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\Szymon Marczak\AppData\Roaming\npm\node_modules\node-gyp\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed   stack:
gyp verb `which` failed    'Error: not found: python2\n    at getNotFoundError (C:\\Users\\Szymon Marczak\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\node_modules\\which\\which.js:13:12)\n    at F (C:\\Users\\Szymon Marczak\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\node_modules\\which\\which.js:68:19)\n    at E (C:\\Users\\Szymon Marczak\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\node_modules\\which\\which.js:80:29)\n    at C:\\Users\\Szymon Marczak\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\node_modules\\which\\which.js:89:16\n    at C:\\Users\\Szymon Marczak\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\node_modules\\isexe\\index.js:42:5\n    at C:\\Users\\Szymon Marczak\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\node_modules\\isexe\\windows.js:36:5\n    at FSReqWrap.oncomplete (fs.js:152:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Python27\python.EXE
gyp verb check python version `C:\Python27\python.EXE -c "import sys; print "2.7.14
gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
gyp verb get node dir no --target version specified, falling back to host node version: 10.9.0
gyp verb command install [ '10.9.0' ]
gyp verb install input version string "10.9.0"
gyp verb install installing version: 10.9.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 10.9.0
gyp verb build dir attempting to create "build" dir: C:\Users\Szymon Marczak\Desktop\demo\build
gyp verb build dir "build" dir needed to be created? C:\Users\Szymon Marczak\Desktop\demo\build
gyp verb find vs2017 Found installation at: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools
gyp verb find vs2017   - Found Microsoft.VisualStudio.Component.Windows10SDK.17134
gyp verb find vs2017   - Found Microsoft.VisualStudio.Component.VC.Tools.x86.x64
gyp verb find vs2017   - Found Microsoft.VisualStudio.VC.MSBuild.Base
gyp verb find vs2017   - Using this installation with Windows 10 SDK
gyp verb find vs2017 using installation: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: C:\Users\Szymon Marczak\Desktop\demo\build\config.gypi
gyp verb config.gypi checking for gypi file: C:\Users\Szymon Marczak\Desktop\demo\config.gypi
gyp verb common.gypi checking for gypi file: C:\Users\Szymon Marczak\Desktop\demo\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn C:\Python27\python.EXE
gyp info spawn args [ 'C:\\Users\\Szymon Marczak\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=2015',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Szymon Marczak\\Desktop\\demo\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Szymon Marczak\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Szymon Marczak\\.node-gyp\\10.9.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Szymon Marczak\\.node-gyp\\10.9.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\Szymon Marczak\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\Szymon Marczak\\.node-gyp\\10.9.0\\<(target_arch)\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\Szymon Marczak\\Desktop\\demo',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\Szymon Marczak\\Desktop\\demo\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir C:\Users\Szymon Marczak\.node-gyp\10.9.0
gyp verb found first Solution file build/binding.sln
gyp verb using MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 01.11.2018 19:49:34.
Project "C:\Users\Szymon Marczak\Desktop\demo\build\binding.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Release|x64".
Project "C:\Users\Szymon Marczak\Desktop\demo\build\binding.sln" (1) is building "C:\Users\Szymon Marczak\Desktop\demo\
build\addon.vcxproj" (2) on node 1 (default targets).
PrepareForBuild:
  Creating directory "Release\obj\addon\".
  Creating directory "Release\obj\addon\addon.tlog\".
InitializeBuildStatus:
  Creating "Release\obj\addon\addon.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\bin\HostX64\x64\CL.exe /c /I
  "C:\Users\Szymon Marczak\.node-gyp\10.9.0\include\node" /I"C:\Users\Szymon Marczak\.node-gyp\10.9.0\src" /I"C:\Users\
  Szymon Marczak\.node-gyp\10.9.0\deps\openssl\config" /I"C:\Users\Szymon Marczak\.node-gyp\10.9.0\deps\openssl\openssl
  \include" /I"C:\Users\Szymon Marczak\.node-gyp\10.9.0\deps\uv\include" /I"C:\Users\Szymon Marczak\.node-gyp\10.9.0\de
  ps\zlib" /I"C:\Users\Szymon Marczak\.node-gyp\10.9.0\deps\v8\include" /Zi /nologo /W3 /WX- /diagnostics:classic /Ox /
  Ob2 /Oi /Ot /Oy /GL /D NODE_GYP_MODULE_NAME=addon /D USING_UV_SHARED=1 /D USING_V8_SHARED=1 /D V8_DEPRECATION_WARNING
  S=1 /D WIN32 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _HAS_EXCEPTIONS=0 /D BUILDING_NODE_EXTENSION
   /D _WINDLL /GF /Gm- /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR- /Fo"Release\obj\addon\\" /Fd"Re
  lease\obj\addon\vc141.pdb" /Gd /TP /wd4251 /wd4275 /wd4267 /wd4351 /wd4355 /wd4800 /wd4251 /FC /errorReport:queue /MP
   ..\hello.cc "C:\Users\Szymon Marczak\AppData\Roaming\npm\node_modules\node-gyp\src\win_delay_load_hook.cc"
  hello.cc
  win_delay_load_hook.cc
Link:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\bin\HostX64\x64\link.exe /ER
  RORREPORT:QUEUE /OUT:"C:\Users\Szymon Marczak\Desktop\demo\build\Release\addon.node" /INCREMENTAL:NO /NOLOGO kernel32
  .lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.l
  ib DelayImp.lib "C:\Users\Szymon Marczak\.node-gyp\10.9.0\x64\node.lib" Delayimp.lib /DELAYLOAD:iojs.exe /DELAYLOAD:n
  ode.exe /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:\Users\Szymon Marc
  zak\Desktop\demo\build\Release\addon.pdb" /MAP /MAPINFO:EXPORTS /OPT:REF /OPT:ICF /TLBID:1 /DYNAMICBASE /NXCOMPAT /MA
  CHINE:X64 /ignore:4199 /LTCG:INCREMENTAL /DLL Release\obj\addon\hello.obj
  Release\obj\addon\win_delay_load_hook.obj
     Creating library C:\Users\Szymon Marczak\Desktop\demo\build\Release\addon.lib and object C:\Users\Szymon Marczak\D
  esktop\demo\build\Release\addon.exp
  Generating code
  All 22 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
  Finished generating code
  addon.vcxproj -> C:\Users\Szymon Marczak\Desktop\demo\build\Release\\addon.node
FinalizeBuildStatus:
  Deleting file "Release\obj\addon\addon.tlog\unsuccessfulbuild".
  Touching "Release\obj\addon\addon.tlog\addon.lastbuildstate".
Done Building Project "C:\Users\Szymon Marczak\Desktop\demo\build\addon.vcxproj" (default targets).

Done Building Project "C:\Users\Szymon Marczak\Desktop\demo\build\binding.sln" (default targets).


Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:03.07
gyp info ok

C:\Users\Szymon Marczak\Desktop\demo>node-gyp build
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  addon.vcxproj -> C:\Users\Szymon Marczak\Desktop\demo\build\Release\\addon.node
gyp info ok

This might help you
npm install -g windows-build-tools

refer: https://superuser.com/questions/1032689/how-do-i-add-vcbuild-exe-to-windows-10-w-o-visual-studio

In addition to running npm install -g windows-build-tools, installing Microsoft .NET Framework SDK resolved the missing VCBuild.exe issue for me.

When I try this "npm install -g windows-build-tools", I got this alert message:
Could not install Visual Studio Build Tools.
Please find more details in the log files, which can be found at
C:UsersLIVELINKS.windows-build-tools

What can I do now

Was this page helpful?
0 / 5 - 0 ratings