[FIXED] npm Install fails error Build failed with error code: 1

Issue

9879 error gyp info it worked if it ends with ok
9879 error gyp verb cli [
9879 error gyp verb cli ‘C:\Program Files\nodejs\node.exe’,
9879 error gyp verb cli ‘C:\Projects\.\node_modules\node-gyp\bin\node-gyp.js’,
9879 error gyp verb cli ‘rebuild’,
9879 error gyp verb cli ‘–verbose’,
9879 error gyp verb cli ‘–libsass_ext=’,
9879 error gyp verb cli ‘–libsass_cflags=’,
9879 error gyp verb cli ‘–libsass_ldflags=’,
9879 error gyp verb cli ‘–libsass_library=’
9879 error gyp verb cli ]
9879 error gyp info using node-gyp@7.1.2
9879 error gyp info using node@16.15.1 | win32 | x64
9879 error gyp verb command rebuild []
9879 error gyp verb command clean []
9879 error gyp verb clean removing "build" directory
9879 error gyp verb command configure []
9879 error gyp verb find Python Python is not set from command line or npm configuration
9879 error gyp verb find Python Python is not set from environment variable PYTHON
9879 error gyp verb find Python checking if "python3" can be used
9879 error gyp verb find Python – executing "python3" to get executable path
9879 error gyp verb find Python – "python3" is not in PATH or produced an error
9879 error gyp verb find Python checking if "python" can be used
9879 error gyp verb find Python – executing "python" to get executable path
9879 error gyp verb find Python – executable path is "C:\Python310\python.exe"
9879 error gyp verb find Python – executing "C:\Python310\python.exe" to get version
9879 error gyp verb find Python – version is "3.10.5"
9879 error gyp info find Python using Python version 3.10.5 found at "C:\Python310\python.exe"
9879 error gyp verb get node dir no –target version specified, falling back to host node version: 16.15.1
9879 error gyp verb command install [ ‘16.15.1’ ]
9879 error gyp verb install input version string "16.15.1"
9879 error gyp verb install installing version: 16.15.1
9879 error gyp verb install –ensure was passed, so won’t reinstall if already installed
9879 error gyp verb install version is already installed, need to check "installVersion"
9879 error gyp verb got "installVersion" 9
9879 error gyp verb needs "installVersion" 9
9879 error gyp verb install version is good
9879 error gyp verb get node dir target node version installed: 16.15.1
9879 error gyp verb build dir attempting to create "build" dir: \node_modules\node-sass\build
9879 error gyp verb build dir "build" dir needed to be created? \node_modules\node-sass\build
9879 error gyp verb find VS msvs_version not set from command line or npm config
9879 error gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
9879 error gyp verb find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Community"
9879 error gyp verb find VS checking VS2019 (16.11.32510.428) found at:
9879 error gyp verb find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
9879 error gyp verb find VS – found "Visual Studio C++ core features"
9879 error gyp verb find VS – found VC++ toolset: v142
9879 error gyp verb find VS – missing any Windows SDK
9879 error gyp verb find VS checking VS2017 (15.9.28307.1974) found at:
9879 error gyp verb find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
9879 error gyp verb find VS – "Visual Studio C++ core features" missing
9879 error gyp verb find VS could not find a version of Visual Studio 2017 or newer to use
9879 error gyp verb find VS looking for Visual Studio 2015
9879 error gyp verb find VS – not found
9879 error gyp verb find VS not looking for VS2013 as it is only supported up to Node.js 8
9879 error gyp ERR! find VS
9879 error gyp ERR! find VS msvs_version not set from command line or npm config
9879 error gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
9879 error gyp ERR! find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Community"
9879 error gyp ERR! find VS checking VS2019 (16.11.32510.428) found at:
9879 error gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
9879 error gyp ERR! find VS – found "Visual Studio C++ core features"
9879 error gyp ERR! find VS – found VC++ toolset: v142
9879 error gyp ERR! find VS – missing any Windows SDK
9879 error gyp ERR! find VS checking VS2017 (15.9.28307.1974) found at:
9879 error gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
9879 error gyp ERR! find VS – "Visual Studio C++ core features" missing
9879 error gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
9879 error gyp ERR! find VS looking for Visual Studio 2015
9879 error gyp ERR! find VS – not found
9879 error gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
9879 error gyp ERR! find VS
9879 error gyp ERR! find VS **************************************************************
9879 error gyp ERR! find VS You need to install the latest version of Visual Studio
9879 error gyp ERR! find VS including the "Desktop development with C++" workload.
9879 error gyp ERR! find VS For more information consult the documentation at:
9879 error gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
9879 error gyp ERR! find VS **************************************************************
9879 error gyp ERR! find VS
9879 error gyp ERR! configure error
9879 error gyp ERR! stack Error: Could not find any Visual Studio installation to use
9879 error gyp ERR! stack at VisualStudioFinder.fail (\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
9879 error gyp ERR! stack at \node_modules\node-gyp\lib\find-visualstudio.js:74:16
9879 error gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
9879 error gyp ERR! stack at \node_modules\node-gyp\lib\find-visualstudio.js:70:14
9879 error gyp ERR! stack at \node_modules\node-gyp\lib\find-visualstudio.js:372:16
9879 error gyp ERR! stack at \node_modules\node-gyp\lib\util.js:54:7
9879 error gyp ERR! stack at \node_modules\node-gyp\lib\util.js:33:16
9879 error gyp ERR! stack at ChildProcess.exithandler (node:child_process:406:5)
9879 error gyp ERR! stack at ChildProcess.emit (node:events:527:28)
9879 error gyp ERR! stack at maybeClose (node:internal/child_process:1092:16)
9879 error gyp ERR! System Windows_NT 10.0.19044
9879 error gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Projects\.\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "–verbose" "–libsass_ext=" "–libsass_cflags=" "–libsass_ldflags=" "–libsass_library="
9879 error gyp ERR! cwd \node_modules\node-sass
9879 error gyp ERR! node -v v16.15.1
9879 error gyp ERR! node-gyp -v v7.1.2
9879 error gyp ERR! not ok
9879 error Build failed with error code: 1
9880 verbose exit 1

{
”: ‘0.1.0’,
npm: ‘7.6.0’,
node: ‘16.15.1’,
v8: ‘9.4.146.24-node.21’,
uv: ‘1.43.0’,
zlib: ‘1.2.11’,
brotli: ‘1.0.9’,
ares: ‘1.18.1’,
modules: ’93’,
nghttp2: ‘1.47.0’,
napi: ‘8’,
llhttp: ‘6.0.4’,
openssl: ‘1.1.1o+quic’,
cldr: ‘40.0’,
icu: ‘70.1’,
tz: ‘2021a3’,
unicode: ‘14.0’,
ngtcp2: ‘0.1.0-DEV’,
nghttp3: ‘0.1.0-DEV’
}

Please share your thoughts on solving these issues with installing dependencies.

Solution

If your Node version is very recent, try downgrading. Stable version 14.16.1 worked.

Answered By – yanir midler

Answer Checked By – David Goodson (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published