npm install error code 1failled to build project - node.js

I wanted to install npm in my project folder but I always have error. I searched a lot and tried different things like installing windows-build-tools with yarn and npm but both freezes in the middel. I have also tried to delete node_modules folder but it gives an eeror that it cannot find it afterwards.I reinstalled node and node-ssas but none worked. I installed python 2.7 and gave the path to node but it seems it wants to download it again. can someone help me what is the problem?
I'm using windows 10
node version 6.14.0
npm 8.3.1
python 2.7
yarn 1.22.17
the latest error is this
ERROR MESSAGE:
'''
npm ERR! code 1
npm ERR! path V:\VOCSensServer\vocsensuimanager\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\windows\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\programs\node\node.exe
V:\VOCSensServer\vocsensuimanager\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose -- libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli 'C:\\programs\\node\\node.exe',
npm ERR! gyp verb cli 'V:\\VOCSensServer\\vocsensuimanager\\node_modules\\node- gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp#3.8.0
npm ERR! gyp info using node#16.14.0 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "c:\programs\python27\python.exe" in the PATH
npm ERR! gyp verb `which` succeeded c:\programs\python27\python.exe c:\programs\python27\python.exe
npm ERR! gyp verb check python version `c:\programs\python27\python.exe -c "import sys; print "2.7.15
npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 16.14.0
npm ERR! gyp verb command install [ '16.14.0' ]
npm ERR! gyp verb install input version string "16.14.0"
npm ERR! gyp verb install installing version: 16.14.0
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 16.14.0
npm ERR! gyp verb build dir attempting to create "build" dir:V:\VOCSensServer\vocsensuimanager\node_modules\node-sass\build
npm ERR! gyp verb build dir "build" dir needed to be created? V:\VOCSensServer\vocsensuimanager\node_modules\node-sass\build
npm ERR! gyp verb find vs2017 Found installation at: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
npm ERR! gyp verb find vs2017 - Missing Visual Studio C++ core features (Microsoft.VisualStudio.VC.MSBuild.Base)
npm ERR! gyp verb find vs2017 - Missing VC++ 2017 v141 toolset (x86,x64) (Microsoft.VisualStudio.Component.VC.Tools.x86.x64)
npm ERR! gyp verb find vs2017 - Missing a Windows SDK (Microsoft.VisualStudio.Component.Windows10SDK.* or Microsoft.VisualStudio.Component.Windows81SDK)
npm ERR! gyp verb find vs2017 - Some required components are missing, not using this installation
npm ERR! gyp verb find vs2017 Found installation at: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
npm ERR! gyp verb find vs2017 - Found Microsoft.VisualStudio.Component.Windows10SDK.16299
npm ERR! gyp verb find vs2017 - Found Microsoft.VisualStudio.Component.Windows10SDK.17134
npm ERR! gyp verb find vs2017 - Found Microsoft.VisualStudio.Component.Windows10SDK.17763
npm ERR! gyp verb find vs2017 - Found Microsoft.VisualStudio.Component.Windows10SDK.18362
npm ERR! gyp verb find vs2017 - Found Microsoft.VisualStudio.Component.Windows10SDK.19041
npm ERR! gyp verb find vs2017 - Found Microsoft.VisualStudio.Component.VC.Tools.x86.x64
npm ERR! gyp verb find vs2017 - Found Microsoft.VisualStudio.VC.MSBuild.Base
npm ERR! gyp verb find vs2017 - Using this installation with Windows 10 SDK
npm ERR! gyp verb find vs2017 using installation: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: V:\VOCSensServer\vocsensuimanager\node_modules\node-sass\build\config.gypi
npm ERR! (node:2808) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp verb config.gypi checking for gypi file: V:\VOCSensServer\vocsensuimanager\node_modules\node-sass\config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: V:\VOCSensServer\vocsensuimanager\node_modules\node-sass\common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "msvs"
npm ERR! gyp info spawn c:\programs\python27\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'V:\\VOCSensServer\\vocsensuimanager\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'msvs',
npm ERR! gyp info spawn args '-G',
npm ERR! gyp info spawn args 'msvs_version=2015',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'V:\\VOCSensServer\\vocsensuimanager\\node_modules\\node-sass\\build\\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'V:\\VOCSensServer\\vocsensuimanager\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\AndiaFathi\\.node-gyp\\16.14.0\\include\\node\\common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=C:\\Users\\AndiaFathi\\.node-gyp\\16.14.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=V:\\VOCSensServer\\vocsensuimanager\\node_modules\\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\Users\\AndiaFathi\\.node-gyp\\16.14.0\\<(target_arch)\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=V:\\VOCSensServer\\vocsensuimanager\\node_modules\\node-sass',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'V:\\VOCSensServer\\vocsensuimanager\\node_modules\\node-sass\\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp verb command build []
npm ERR! gyp verb build type Release
npm ERR! gyp verb architecture x64
npm ERR! gyp verb node dev dir C:\Users\AndiaFathi\.node-gyp\16.14.0
npm ERR! gyp verb found first Solution file build/binding.sln
npm ERR! gyp verb using MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'build/binding.sln',
npm ERR! gyp info spawn args '/nologo',
npm ERR! gyp info spawn args '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! UNCAUGHT EXCEPTION
npm ERR! gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\15.0\Bin\MSBuild.exe ENOENT
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
npm ERR! gyp ERR! stack at onErrorNT (node:internal/child_process:478:16)
npm ERR! gyp ERR! stack at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm ERR! gyp ERR! command "C:\\programs\\node\\node.exe" "V:\\VOCSensServer\\vocsensuimanager\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd V:\VOCSensServer\vocsensuimanager\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.14.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! This is a bug in `node-gyp`.
npm ERR! gyp ERR! Try to update node-gyp and file an Issue if it does not help:
npm ERR! gyp ERR! <https://github.com/nodejs/node-gyp/issues>
npm ERR! Build failed with error code: 7
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\AndiaFathi\AppData\Local\npm-cache\_logs\2022-03-14T13_08_19_585Z-debug-0.log
'''

You did right for Python as it says succeeded after checking for the Python executable. But the problem is that there is no 15.0 directory in Visual Studio 2019 (ENOENT).
You should change the path to MSBuild.exe. It should be like:
v2017
npm config set msbuild_path "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin\\MSBuild.exe"
npm config set msvs_version 2017
v2019
npm config set msbuild_path "C:\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\MSBuild\\Current\\Bin\\MSBuild.exe"
npm config set msvs_version 2019
v2022
npm config set msbuild_path "C:\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\MSBuild\\Current\\Bin\\MSBuild.exe"
npm config set msvs_version 2022
You can check your npm configuration by using:
npm config list
I had the same problem and found the solution on this post.

Related

Reactjs node gyp error when installing node sass

I was trying to build a new project on React and I want to use SASS, but when I start installing npm install node-sass it gives me this node-gyp error
jake#Ehys-Air portfolio % npm install node-sass
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 1
npm ERR! path /Users/jake/Development/portfolio/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /usr/local/bin/node /Users/jake/Development/portfolio/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli '/usr/local/bin/node',
npm ERR! gyp verb cli '/Users/jake/Development/portfolio/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp#8.4.1
npm ERR! gyp info using node#18.4.0 | darwin | arm64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb find Python Python is not set from command line or npm configuration
npm ERR! gyp verb find Python Python is not set from environment variable PYTHON
npm ERR! gyp verb find Python checking if "python3" can be used
npm ERR! gyp verb find Python - executing "python3" to get executable path
npm ERR! gyp verb find Python - executable path is "/Library/Frameworks/Python.framework/Versions/3.9/bin/python3"
npm ERR! gyp verb find Python - executing "/Library/Frameworks/Python.framework/Versions/3.9/bin/python3" to get version
npm ERR! gyp verb find Python - version is "3.9.10"
npm ERR! gyp info find Python using Python version 3.9.10 found at "/Library/Frameworks/Python.framework/Versions/3.9/bin/python3"
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 18.4.0
npm ERR! gyp verb command install [ '18.4.0' ]
npm ERR! gyp verb install input version string "18.4.0"
npm ERR! gyp verb install installing version: 18.4.0
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 18.4.0
npm ERR! gyp verb build dir attempting to create "build" dir: /Users/jake/Development/portfolio/node_modules/node-sass/build
npm ERR! gyp verb build dir "build" dir needed to be created? Yes
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: /Users/jake/Development/portfolio/node_modules/node-sass/build/config.gypi
npm ERR! gyp verb config.gypi checking for gypi file: /Users/jake/Development/portfolio/node_modules/node-sass/config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: /Users/jake/Development/portfolio/node_modules/node-sass/common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "make"
npm ERR! gyp info spawn /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/jake/Development/portfolio/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/jake/Development/portfolio/node_modules/node-sass/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/jake/Development/portfolio/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/jake/Library/Caches/node-gyp/18.4.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/jake/Library/Caches/node-gyp/18.4.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/jake/Development/portfolio/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/jake/Library/Caches/node-gyp/18.4.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/jake/Development/portfolio/node_modules/node-sass',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp verb command build []
npm ERR! gyp verb build type Release
npm ERR! gyp verb architecture arm64
npm ERR! gyp verb node dev dir /Users/jake/Library/Caches/node-gyp/18.4.0
npm ERR! gyp verb `which` succeeded for `make` /usr/bin/make
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! xcrun: error: active developer path ("/Library/Developer/CommandLineTools") does not exist
npm ERR! Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
npm ERR! See `man xcode-select` for more details.
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onExit (/Users/jake/Development/portfolio/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:537:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 20.6.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/Users/jake/Development/portfolio/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /Users/jake/Development/portfolio/node_modules/node-sass
npm ERR! gyp ERR! node -v v18.4.0
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jake/.npm/_logs/2022-07-23T07_23_01_464Z-debug-0.log
I am not sure why this is happening because before I used to use SASS/SCSS on my previous react builds. This is kind of frustrating to be honest for a newbie dev like me.
Fixed this problem by installing xcode-select --install because I don't have this command line tools npm ERR! xcrun: error: active developer path ("/Library/Developer/CommandLineTools") does not exist

Getting errors while installing node-sass

When I install node-sass for a React project, it gives me the error below. I tried lot of things but none did work. I tried to delete it and install it again, I tried to start a new project but it's still not working. I updated everything to the last version: node.js to v16.14.0 and npm to v8.3.1.
npm ERR! code 1
npm ERR! path C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli 'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli 'C:\\Users\\XXXXX\\Documents\\GitHub\\XXXXX\\Frontend\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp#3.8.0
npm ERR! gyp info using node#16.14.0 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb download using dist-url https://npm.taobao.org/dist
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\node-gyp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\node-gyp\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\node-gyp\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\node-gyp\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp verb `which` failed python2 Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\node-gyp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\node-gyp\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\node-gyp\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\node-gyp\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:198:21) {
npm ERR! gyp verb `which` failed code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` succeeded python C:\Python27\python.EXE
npm ERR! gyp verb check python version `C:\Python27\python.EXE -c "import sys; print "2.7.15
npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 16.14.0
npm ERR! gyp verb command install [ '16.14.0' ]
npm ERR! gyp verb download using dist-url https://npm.taobao.org/dist
npm ERR! gyp verb install input version string "16.14.0"
npm ERR! gyp verb install installing version: 16.14.0
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 16.14.0
npm ERR! gyp verb build dir attempting to create "build" dir: C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\node-sass\build
npm ERR! gyp verb build dir "build" dir needed to be created? C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\node-sass\build
npm ERR! gyp verb find vs2017 Found installation at: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
npm ERR! gyp verb find vs2017 - Found Microsoft.VisualStudio.Component.Windows10SDK.19041
npm ERR! gyp verb find vs2017 - Found Microsoft.VisualStudio.Component.VC.Tools.x86.x64
npm ERR! gyp verb find vs2017 - Found Microsoft.VisualStudio.VC.MSBuild.Base
npm ERR! gyp verb find vs2017 - Using this installation with Windows 10 SDK
npm ERR! gyp verb find vs2017 using installation: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\node-sass\build\config.gypi
npm ERR! (node:20452) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp verb config.gypi checking for gypi file: C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\node-sass\config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\node-sass\common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "msvs"
npm ERR! gyp info spawn C:\Python27\python.EXE
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'C:\\Users\\XXXXX\\Documents\\GitHub\\XXXXX\\Frontend\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'msvs',
npm ERR! gyp info spawn args '-G',
npm ERR! gyp info spawn args 'msvs_version=2015',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\XXXXX\\Documents\\GitHub\\XXXXX\\Frontend\\node_modules\\node-sass\\build\\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\XXXXX\\Documents\\GitHub\\XXXXX\\Frontend\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\XXXXX\\.node-gyp\\16.14.0\\include\\node\\common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=C:\\Users\\XXXXX\\.node-gyp\\16.14.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\XXXXX\\Documents\\GitHub\\XXXXX\\Frontend\\node_modules\\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\Users\\XXXXX\\.node-gyp\\16.14.0\\<(target_arch)\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=C:\\Users\\XXXXX\\Documents\\GitHub\\XXXXX\\Frontend\\node_modules\\node-sass',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'C:\\Users\\XXXXX\\Documents\\GitHub\\XXXXX\\Frontend\\node_modules\\node-sass\\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp verb command build []
npm ERR! gyp verb download using dist-url https://npm.taobao.org/dist
npm ERR! gyp verb build type Release
npm ERR! gyp verb architecture x64
npm ERR! gyp verb node dev dir C:\Users\XXXXX\.node-gyp\16.14.0
npm ERR! gyp verb found first Solution file build/binding.sln
npm ERR! gyp verb using MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'build/binding.sln',
npm ERR! gyp info spawn args '/nologo',
npm ERR! gyp info spawn args '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! UNCAUGHT EXCEPTION
npm ERR! gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
npm ERR! gyp ERR! stack at onErrorNT (node:internal/child_process:478:16)
npm ERR! gyp ERR! stack at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\XXXXX\\Documents\\GitHub\\XXXXX\\Frontend\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd C:\Users\XXXXX\Documents\GitHub\XXXXX\Frontend\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.14.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! This is a bug in `node-gyp`.
npm ERR! gyp ERR! Try to update node-gyp and file an Issue if it does not help:
npm ERR! gyp ERR! <https://github.com/nodejs/node-gyp/issues>
npm ERR! Build failed with error code: 7
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\XXXXX\AppData\Local\npm-cache\_logs\2022-02-14T22_43_35_171Z-debug-0.log
Just change the node version to v14.x.x
Or you may try installing newer versions of node-gpy
Here, read this issue:
https://github.com/sass/node-sass/issues/3117
First solution
Make sure your node.js version is not superior than the recommended one. If not downgrade it, and for that you coud use n package from npm:
npm install -g n
n stable
# if one of the commands does not pass, you may need to use sudo
sudo npm install -g n
sudo n stable
Then you would wanna use sass package instead of node-sass, as it's deprecated. And for that run those commands:
npm uninstall node-sass --save
npm install sass --save
Second solution
If you need or want node-sass for some reasons, you should downgrade your nodejs version to like v14. For that you can use n package from npm:
npm install -g n
n 14
# if one of the commands does not pass, you may need to use sudo
sudo npm install -g n
sudo n 14
Don't use node-sass package
Since node-sass is been deprecated, you will have to use its new version, which is sass.
You can uninstall the old and install the new one with this command
npm uninstall node-sass
npm install sass

Issue trying to clone a project and do "npm install" with react and sass

I clone a project from github, and was trying to install npm in the porject's directory, but a error occur.
I had nodejs, npm and visual studio code installed and then i uninstalled, and reinstalled to upgrade.
The versions that i am using now are:
nodejs v16.13.2
npm v8.3.2
VScode 2017
Then i clone the project, when i try to do "npm install":
npm ERR! path C:\Users\crist\Documents\project\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe C:\Users\crist\Documents\project\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli 'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli 'C:\\Users\\crist\\Documents\\project\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp#3.8.0
npm ERR! gyp info using node#16.13.2 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "C:\Users\crist\.windows-build-tools\python27\python.exe" in the PATH
npm ERR! gyp verb `which` succeeded C:\Users\crist\.windows-build-tools\python27\python.exe C:\Users\crist\.windows-build-tools\python27\python.exe
npm ERR! gyp verb check python version `C:\Users\crist\.windows-build-tools\python27\python.exe -c "import sys; print "2.7.15
npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 16.13.2
npm ERR! gyp verb command install [ '16.13.2' ]
npm ERR! gyp verb install input version string "16.13.2"
npm ERR! gyp verb install installing version: 16.13.2
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 16.13.2
npm ERR! gyp verb build dir attempting to create "build" dir: C:\Users\crist\Documents\project\node_modules\node-sass\build
npm ERR! gyp verb build dir "build" dir needed to be created? C:\Users\crist\Documents\project\node_modules\node-sass\build
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: C:\Users\crist\Documents\project\node_modules\node-sass\build\config.gypi
npm ERR! (node:23160) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp verb config.gypi checking for gypi file: C:\Users\crist\Documents\project\node_modules\node-sass\config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: C:\Users\crist\Documents\project\node_modules\node-sass\common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "msvs"
npm ERR! gyp info spawn C:\Users\crist\.windows-build-tools\python27\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'C:\\Users\\crist\\Documents\\project\\node_modules\\node-gyp\\gyp\\gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'msvs',
npm ERR! gyp info spawn args '-G',
npm ERR! gyp info spawn args 'msvs_version=2019',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\crist\\Documents\\project\\node_modules\\node-sass\\build\\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\crist\\Documents\\project\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\crist\\.node-gyp\\16.13.2\\include\\node\\common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=C:\\Users\\crist\\.node-gyp\\16.13.2',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\crist\\Documents\\project\\node_modules\\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\Users\\crist\\.node-gyp\\16.13.2\\<(target_arch)\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=C:\\Users\\crist\\Documents\\project\\node_modules\\node-sass',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'C:\\Users\\crist\\Documents\\project\\node_modules\\node-sass\\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Traceback (most recent call last):
npm ERR! File "C:\Users\crist\Documents\project\node_modules\node-gyp\gyp\gyp_main.py", line 16, in <module>
npm ERR! sys.exit(gyp.script_main())
npm ERR! File "C:\Users\crist\Documents\project\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 545, in script_main
npm ERR! return main(sys.argv[1:])
npm ERR! File "C:\Users\crist\Documents\project\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 538, in main
npm ERR! return gyp_main(args)
npm ERR! File "C:\Users\crist\Documents\project\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 514, in gyp_main
npm ERR! options.duplicate_basename_check)
npm ERR! File "C:\Users\crist\Documents\project\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 98, in Load
npm ERR! generator.CalculateVariables(default_variables, params)
npm ERR! File "C:\Users\crist\Documents\project\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1916, in CalculateVariables
npm ERR! generator_flags.get('msvs_version', 'auto'))
npm ERR! File "C:\Users\crist\Documents\project\node_modules\node-gyp\gyp\pylib\gyp\MSVSVersion.py", line 434, in SelectVisualStudioVersion
npm ERR! versions = _DetectVisualStudioVersions(version_map[version], 'e' in version)
npm ERR! KeyError: '2019'
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (C:\Users\crist\Documents\project\node_modules\node-gyp\lib\configure.js:345:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\crist\\Documents\\project\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd C:\Users\crist\Documents\project\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.13.2
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\crist\AppData\Local\npm-cache\_logs\2022-01-23T23_41_36_294Z-debug-0.log```
Anyone had this problem or know how to fix it?
Try this Three Solutions:
First Method: if you already installed node-sass then uninstall it :-
npm uninstall node-sass
then after process install sass :- npm i -D sass
Second Method: please check your node version if it old then it gives error
and reinstall node with latest LTS version https://nodejs.org/en/
Third Method:- Install node version 12 if not working on 16 or LTS version.
note: restart your code editor after installing node i sass (its not compulsory but sometimes code editor blocking the process).
To check node version type :- node -v
You need to check if the node version installed in your machine is compatible with the node-sass version installed in the project.
In your terminal do node -v to check your node version and look at the node-sass version of the cloned project in the package.json file. Look at the following answer for more information on what version of node-sass is compatible with what version of node.
Check this answer https://stackoverflow.com/a/67778126/9241178

npm install node-sass throwing error code 1

I'm working on a project and got the clone of the project from bitbucket. When I run npm install I run into an error with node-sass. I've tried removing the package-lock and node_modules and running npm i again. I've tried upgrading and updating npm. none of my other partners on the project are running into this error and can clone and npm i just fine. I'll post the error below along with a few of the things I've tried.
I tried the good ol' restart and reboot computer, I've uninstalled and tried reinstalling node. I've ran the command with sudo, I've deleted the package-lock and node_modules. I've upgraded and updated node (16.0.0), i've tried installing the exact version of node-sass that is working on a partners computer (npm i node-sass#4.14.1)
any suggestions would help!
Blake-MBP:checkout blake$ npm i
npm ERR! code 1
npm ERR! path /Users/directory/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /usr/local/Cellar/node/16.0.0_1/bin/node /Users/directory/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli '/usr/local/Cellar/node/16.0.0_1/bin/node',
npm ERR! gyp verb cli '/Users/directory/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp#3.8.0
npm ERR! gyp info using node#16.0.0 | darwin | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` succeeded python2 /usr/bin/python2
npm ERR! gyp verb check python version `/usr/bin/python2 -c "import sys; print "2.7.16
npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 16.0.0
npm ERR! gyp verb command install [ '16.0.0' ]
npm ERR! gyp verb install input version string "16.0.0"
npm ERR! gyp verb install installing version: 16.0.0
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 16.0.0
npm ERR! gyp verb build dir attempting to create "build" dir: /Users/directory/node_modules/node-sass/build
npm ERR! gyp verb build dir "build" dir needed to be created? /Users/directory/node_modules/node-sass/build
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: /Users/directory/node_modules/node-sass/build/config.gypi
npm ERR! (node:22467) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp verb config.gypi checking for gypi file: /Users/directory/node_modules/node-sass/config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: /Users/directory/node-sass/common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "make"
npm ERR! gyp info spawn /usr/bin/python2
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/directory/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/directory/node_modules/node-sass/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/directory/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/blake/.node-gyp/16.0.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/blake/.node-gyp/16.0.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/directory/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/blake/.node-gyp/16.0.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/directory/node_modules/node-sass',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
npm ERR!
npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
npm ERR!
npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
npm ERR!
npm ERR! gyp: No Xcode or CLT version detected!
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/Users/directory/node_modules/node-gyp/lib/configure.js:345:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:365:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 20.4.0
npm ERR! gyp ERR! command "/usr/local/Cellar/node/16.0.0_1/bin/node" "/Users/directory/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /Users/directory/node_modules/node-sass
npm ERR! gyp ERR! node -v v16.0.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/blake/.npm/_logs/2021-05-05T20_24_58_220Z-debug.log
Turns out updating node was the problem. I rolled back to npm version #16.0.0 and node-sass didn't have any errors installing after that.

Cannot install Gulp-sass on macOS Big Sur 11.4

when starting Gulp today, I got the message that gulp-sass was not installed:
Error: Cannot find module 'gulp-sass'
Apparently some node_modules have been removed.
So I tried to remove and reinstall it like described here:
npm install gulp-sass
But got errors, so i changed node 16 with nvm through node 15.
Python2 and xcode is installed.
But it doesnt work and i get the following errors:
~/Developer ❯ nvm use 15
Now using node v15.14.0 (npm v7.7.6)
~/Developer ❯ npm install gulp-sass 17:17:40
npm ERR! code 1
npm ERR! path /Users/MYUSERNAME/Developer/node_modules/gulp-sass/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /Users/MYUSERNAME/.nvm/versions/node/v15.14.0/bin/node /Users/MYUSERNAME/Developer/node_modules/gulp-sass/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli '/Users/MYUSERNAME/.nvm/versions/node/v15.14.0/bin/node',
npm ERR! gyp verb cli '/Users/MYUSERNAME/Developer/node_modules/gulp-sass/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp#3.8.0
npm ERR! gyp info using node#15.14.0 | darwin | arm64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` succeeded python2 /Library/Frameworks/Python.framework/Versions/2.7/bin/python2
npm ERR! gyp verb check python version `/Library/Frameworks/Python.framework/Versions/2.7/bin/python2 -c "import sys; print "2.7.18
npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 15.14.0
npm ERR! gyp verb command install [ '15.14.0' ]
npm ERR! gyp verb install input version string "15.14.0"
npm ERR! gyp verb install installing version: 15.14.0
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 15.14.0
npm ERR! gyp verb build dir attempting to create "build" dir: /Users/MYUSERNAME/Developer/node_modules/gulp-sass/node_modules/node-sass/build
npm ERR! gyp verb build dir "build" dir needed to be created? /Users/MYUSERNAME/Developer/node_modules/gulp-sass/node_modules/node-sass/build
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: /Users/MYUSERNAME/Developer/node_modules/gulp-sass/node_modules/node-sass/build/config.gypi
npm ERR! gyp verb config.gypi checking for gypi file: /Users/MYUSERNAME/Developer/node_modules/gulp-sass/node_modules/node-sass/config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: /Users/MYUSERNAME/Developer/node_modules/gulp-sass/node_modules/node-sass/common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "make"
npm ERR! gyp info spawn /Library/Frameworks/Python.framework/Versions/2.7/bin/python2
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/MYUSERNAME/Developer/node_modules/gulp-sass/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/MYUSERNAME/Developer/node_modules/gulp-sass/node_modules/node-sass/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/MYUSERNAME/Developer/node_modules/gulp-sass/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/MYUSERNAME/.node-gyp/15.14.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/MYUSERNAME/.node-gyp/15.14.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/MYUSERNAME/Developer/node_modules/gulp-sass/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/MYUSERNAME/.node-gyp/15.14.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/MYUSERNAME/Developer/node_modules/gulp-sass/node_modules/node-sass',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
npm ERR!
npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
npm ERR!
npm ERR! No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
npm ERR!
npm ERR! gyp: No Xcode or CLT version detected!
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/Users/MYUSERNAME/Developer/node_modules/gulp-sass/node_modules/node-gyp/lib/configure.js:345:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:369:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 20.5.0
npm ERR! gyp ERR! command "/Users/MYUSERNAME/.nvm/versions/node/v15.14.0/bin/node" "/Users/MYUSERNAME/Developer/node_modules/gulp-sass/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /Users/MYUSERNAME/Developer/node_modules/gulp-sass/node_modules/node-sass
npm ERR! gyp ERR! node -v v15.14.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/MYUSERNAME/.npm/_logs/2021-06-07T15_17_46_462Z-debug.log
I did uninstall/reinstall Nodejs, but that didn't help.
Does anyone have an idea?
Thanks in advance!
For me it helps to correct the path to my installed command-line tools (CTL) with the following command:
sudo xcode-select -r
and use gulp-dart-sass

Resources