node-gyp: Error: spawn C:\Program ENOENT (Cannot build anything.)

  • Node Version: Node: v14.16.0, NPM: v6.14.11
  • Platform:
    • OS Name: Microsoft Windows 10 Enterprise
    • OS Version: 10.0.19042 N/A Build 19042
    • System Type: x64-based PC
  • Compiler:
    • Microsoft ® Build Engine version 16.9.0+57a23d249 for .NET Framework
    • Copyright © Microsoft Corporation. All rights reserved.
    • v16.9.0.11203
  • Module: Any type of npm module that uses c++ bindings.
Verbose output (from npm or node-gyp):
D:\BDT\Desktop\leds>npm i --verbose naudiodon
npm info it worked if it ends with ok
npm verb cli [
npm verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm verb cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli   'i',
npm verb cli   '--verbose',
npm verb cli   'naudiodon'
npm verb cli ]
npm info using npm@6.14.11
npm info using node@v14.16.0
npm verb npm-session bf26b72f4060206a
npm http fetch GET 304 https://registry.npmjs.org/naudiodon 915ms (from cache)
npm timing stage:loadCurrentTree Completed in 1160ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 2ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 117ms
npm http fetch GET 304 https://registry.npmjs.org/segfault-handler 32ms (from cache)
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 150ms
npm timing stage:loadIdealTree Completed in 304ms
npm timing stage:generateActionsToTake Completed in 16ms
npm verb correctMkdir C:\Users\BDT\AppData\Roaming\npm-cache\_locks correctMkdir not in flight; initializing
npm verb makeCacheDir UID & GID are irrelevant on win32
npm verb lock using C:\Users\BDT\AppData\Roaming\npm-cache\_locks\staging-26116c22c41bef2d.lock for D:\BDT\Desktop\leds\node_modules\.staging
npm timing action:extract Completed in 51ms
npm timing action:finalize Completed in 5ms
npm timing action:refresh-package-json Completed in 35ms
npm info lifecycle segfault-handler@1.3.0~preinstall: segfault-handler@1.3.0
npm info lifecycle naudiodon@2.3.4~preinstall: naudiodon@2.3.4
npm timing action:preinstall Completed in 2ms
npm info linkStuff segfault-handler@1.3.0
npm info linkStuff naudiodon@2.3.4
npm timing action:build Completed in 1ms
npm info lifecycle segfault-handler@1.3.0~install: segfault-handler@1.3.0

> segfault-handler@1.3.0 install D:\BDT\Desktop\leds\node_modules\segfault-handler
> node-gyp rebuild


D:\BDT\Desktop\leds\node_modules\segfault-handler>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild'
gyp verb cli ]
gyp info using node-gyp@5.1.0
gyp info using node@14.16.0 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb find Python checking Python explicitly set from command line or npm configuration
gyp verb find Python - "--python=" or "npm config get python" is "C:/Python39/python.exe"
gyp verb find Python - executing "C:/Python39/python.exe" to get executable path
gyp verb find Python - executable path is "C:\Python39\python.exe"
gyp verb find Python - executing "C:\Python39\python.exe" to get version
gyp verb find Python - version is "3.9.2"
gyp info find Python using Python version 3.9.2 found at "C:\Python39\python.exe"
gyp verb get node dir no --target version specified, falling back to host node version: 14.16.0
gyp verb command install [ '14.16.0' ]
gyp verb install input version string "14.16.0"
gyp verb install installing version: 14.16.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: 14.16.0
gyp verb build dir attempting to create "build" dir: D:\BDT\Desktop\leds\node_modules\segfault-handler\build
gyp verb build dir "build" dir needed to be created? D:\BDT\Desktop\leds\node_modules\segfault-handler\build
gyp verb find VS msvs_version was set from command line or npm config
gyp verb find VS - looking for Visual Studio version 2017
gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp verb find VS checking VS2019 (16.9.31112.23) found at:
gyp verb find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp verb find VS - found "Visual Studio C++ core features"
gyp verb find VS - found VC++ toolset: v142
gyp verb find VS - found Windows SDK: 10.0.19041.0
gyp verb find VS - msvs_version does not match this version
gyp verb find VS checking VS2019 (16.9.31112.23) found at:
gyp verb find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
gyp verb find VS - found "Visual Studio C++ core features"
gyp verb find VS - found VC++ toolset: v142
gyp verb find VS - found Windows SDK: 10.0.19041.0
gyp verb find VS - msvs_version does not match this version
gyp verb find VS checking VS2017 (15.9.28307.1440) found at:
gyp verb find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
gyp verb find VS - found "Visual Studio C++ core features"
gyp verb find VS - found VC++ toolset: v141
gyp verb find VS - found Windows SDK: 10.0.17763.0
gyp info find VS using VS2017 (15.9.28307.1440) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
gyp info find VS run with --verbose for detailed information
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: D:\BDT\Desktop\leds\node_modules\segfault-handler\build\config.gypi
gyp verb config.gypi checking for gypi file: D:\BDT\Desktop\leds\node_modules\segfault-handler\config.gypi
gyp verb common.gypi checking for gypi file: D:\BDT\Desktop\leds\node_modules\segfault-handler\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn C:\Python39\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\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   '-I',
gyp info spawn args   'D:\\BDT\\Desktop\\leds\\node_modules\\segfault-handler\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\BDT\\AppData\\Local\\node-gyp\\Cache\\14.16.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\\BDT\\AppData\\Local\\node-gyp\\Cache\\14.16.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\BDT\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\14.16.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=D:\\BDT\\Desktop\\leds\\node_modules\\segfault-handler',
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   'D:\\BDT\\Desktop\\leds\\node_modules\\segfault-handler\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir C:\Users\BDT\AppData\Local\node-gyp\Cache\14.16.0
gyp verb found first Solution file build/binding.sln
gyp verb using MSBuild: C:\Program
gyp info spawn C:\Program
gyp info spawn args [
gyp info spawn args   'build/binding.sln',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn C:\Program ENOENT
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
gyp ERR! stack     at onErrorNT (internal/child_process.js:465:16)
gyp ERR! stack     at processTicksAndRejections (internal/process/task_queues.js:80:21)
gyp ERR! System Windows_NT 10.0.19042
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 D:\BDT\Desktop\leds\node_modules\segfault-handler
gyp ERR! node -v v14.16.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR!     <https://github.com/nodejs/node-gyp/issues>
npm verb lifecycle segfault-handler@1.3.0~install: unsafe-perm in lifecycle true
npm verb lifecycle segfault-handler@1.3.0~install: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\BDT\Desktop\leds\node_modules\segfault-handler\node_modules\.bin;D:\BDT\Desktop\leds\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Oculus\Support\oculus-runtime;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\dotnet\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;d:\Program Files (x86)\Gow\bin;C:\Users\BDT\AppData\Local\Microsoft\WindowsApps;D:\Users\BDT\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\BDT\AppData\Local\GitHubDesktop\bin;C:\PATH;C:\Users\BDT\.dotnet\tools;C:\Users\BDT\AppData\Roaming\npm;C:\Program Files\nodejs\;
npm verb lifecycle segfault-handler@1.3.0~install: CWD: D:\BDT\Desktop\leds\node_modules\segfault-handler
npm timing audit submit Completed in 926ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 926ms
npm timing audit body Completed in 0ms
npm info lifecycle segfault-handler@1.3.0~install: Failed to exec install script
npm timing action:install Completed in 1139ms
npm verb unlock done using C:\Users\BDT\AppData\Roaming\npm-cache\_locks\staging-26116c22c41bef2d.lock for D:\BDT\Desktop\leds\node_modules\.staging
npm timing stage:rollbackFailedOptional Completed in 11ms
npm timing stage:runTopLevelLifecycles Completed in 2770ms
npm WARN leds@1.0.0 No description
npm WARN leds@1.0.0 No repository field.

npm verb stack Error: segfault-handler@1.3.0 install: `node-gyp rebuild`
npm verb stack Exit status 7
npm verb stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
npm verb stack     at EventEmitter.emit (events.js:315:20)
npm verb stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
npm verb stack     at ChildProcess.emit (events.js:315:20)
npm verb stack     at maybeClose (internal/child_process.js:1048:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
npm verb pkgid segfault-handler@1.3.0
npm verb cwd D:\BDT\Desktop\leds
npm verb Windows_NT 10.0.19042
npm verb argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "--verbose" "naudiodon"
npm verb node v14.16.0
npm verb npm  v6.14.11
npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! segfault-handler@1.3.0 install: `node-gyp rebuild`
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the segfault-handler@1.3.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 7, true ]
npm timing npm Completed in 3154ms

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\BDT\AppData\Roaming\npm-cache\_logs\2021-04-09T17_29_41_858Z-debug.log
But I can build manually when I go to module location and run node-gyp manually:
$ npm i <module-name> --force
$ cd node_modules/<module-name>
$ node-gyp rebuild

This way i can successfully install the modules with bindings but this is so tedious to do.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Why does it use such an old version then makes no sense, since I am on latest node version.