'Getting yarn install gyp error with @vscode/sqlite3

Computer : MacBook Pro (16-inch, 2019) - Intel I7

OS : Monterey 12.3.1

Python Version : 3.8.0

Node Version : v14.17.6

Node-gyp : v7.1.2

I was able to run yarn install from this project before, but after an update I am having this issue. I have tried:

Deleting node_modules folder and cloning the repo again: Did not work.

Cleaning npm cache : Did not work.

Deleting yarn.lock and package.json.lock files and re-running everything : Did not work.

Deleting the ~/.node-gyp folder : Did not work.

Deleting ~/.npmrc file : Did not work.

[5/5] 🔨  Building fresh packages...
[-/13] ⠐ waiting...
[-/13] ⠐ waiting...
[10/13] ⠐ @vscode/sqlite3
[11/13] ⠐ nodegit
error /Users/matspeda/Documents/GitHub/hm-backstage/node_modules/@vscode/sqlite3: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /Users/matspeda/Documents/GitHub/hm-backstage/node_modules/@vscode/sqlite3
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info find Python using Python version 3.8.0 found at "/Library/Frameworks/Python.framework/Versions/3.8/bin/python3"
gyp info spawn /Library/Frameworks/Python.framework/Versions/3.8/bin/python3
gyp info spawn args [
gyp info spawn args   '/Users/matspeda/Documents/GitHub/hm-backstage/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/matspeda/Documents/GitHub/hm-backstage/node_modules/@vscode/sqlite3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/matspeda/Documents/GitHub/hm-backstage/node_modules/@npmcli/run-script/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/matspeda/Library/Caches/node-gyp/14.17.6/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/matspeda/Library/Caches/node-gyp/14.17.6',
gyp info spawn args   '-Dnode_gyp_dir=/Users/matspeda/Documents/GitHub/hm-backstage/node_modules/@npmcli/run-script/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/matspeda/Library/Caches/node-gyp/14.17.6/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/matspeda/Documents/GitHub/hm-backstage/node_modules/@vscode/sqlite3',
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   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CC(target) Release/obj.target/nothing/../../node-addon-api/nothing.o
  LIBTOOL-STATIC Release/nothing.a
env: python: No such file or directory
make: *** [Release/nothing.a] Error 127
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/matspeda/Documents/GitHub/hm-backstage/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 21.4.0
gyp ERR! command "/Users/matspeda/.nvm/versions/node/v14.17.6/bin/node" "/Users/matspeda/Documents/GitHub/hm-backstage/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/matspeda/Documents/GitHub/hm-backstage/node_modules/@vscode/sqlite3
gyp ERR! node -v v14.17.6




warning Error running install script for optional dependency: "/Users/matspeda/Documents/GitHub/hm-backstage/node_modules/cpu-features: Command failed.
Exit code: 1
Command: node buildcheck.js > buildcheck.gypi && node-gyp rebuild
Arguments: 
Directory: /Users/matspeda/Documents/GitHub/hm-backstage/node_modules/cpu-features
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info find Python using Python version 3.8.0 found at \"/Library/Frameworks/Python.framework/Versions/3.8/bin/python3\"
gyp info spawn /Library/Frameworks/Python.framework/Versions/3.8/bin/python3
gyp info spawn args [
gyp info spawn args   '/Users/matspeda/Documents/GitHub/hm-backstage/node_modules/@npmcli/run-script/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/matspeda/Documents/GitHub/hm-backstage/node_modules/cpu-features/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/matspeda/Documents/GitHub/hm-backstage/node_modules/@npmcli/run-script/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/matspeda/Library/Caches/node-gyp/14.17.6/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/matspeda/Library/Caches/node-gyp/14.17.6',
gyp info spawn args   '-Dnode_gyp_dir=/Users/matspeda/Documents/GitHub/hm-backstage/node_modules/@npmcli/run-script/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/matspeda/Library/Caches/node-gyp/14.17.6/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/matspeda/Documents/GitHub/hm-backstage/node_modules/cpu-features',
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   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_linux_or_android.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_arm_linux_or_android.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_mips_linux_or_android.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_ppc_linux.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_freebsd.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_linux_or_android.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_macos.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_windows.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/filesystem.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/stack_line_reader.o
  CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/string_view.o
  LIBTOOL-STATIC Release/cpu_features.a
env: python: No such file or directory
make: *** [Release/cpu_features.a] Error 127
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/matspeda/Documents/GitHub/hm-backstage/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 21.4.0
gyp ERR! command \"/Users/matspeda/.nvm/versions/node/v14.17.6/bin/node\" \"/Users/matspeda/Documents/GitHub/hm-backstage/node_modules/.bin/node-gyp\" \"rebuild\"
gyp ERR! cwd /Users/matspeda/Documents/GitHub/hm-backstage/node_modules/cpu-features
gyp ERR! node -v v14.17.6
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok"
info This module is OPTIONAL, you can safely ignore this error


Solution 1:[1]

In case anyone stumbles with same/similar issue. There was one folder I did not see mentioned online to remove which I ended up removing , then restarting the system which finnally fixed my problem.

Delete the following folder. You can use Finder > Go to folder > Replace with your user below :

/Users/username/Library/Caches/node-gyp

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Matias Spedaletti