MAC npm install issue with gyp - npm

I was trying to install the npm, but I keep getting this error that I think is related to the hummus module:
npm WARN deprecated ini#1.3.5: Please update to ini >=1.3.6 to avoid a prototype pollution issue
npm ERR! code 1
npm ERR! path /Users/abcd/Desktop/project/project_l_api/node_modules/hummus
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#7.1.2
npm ERR! gyp info using node#15.8.0 | darwin | x64
npm ERR! gyp info find Python using Python version 3.9.1 found at "/usr/local/opt/python#3.9/bin/python3.9"
npm ERR! gyp info spawn /usr/local/opt/python#3.9/bin/python3.9
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/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/abcd/Desktop/project/project_l_api/node_modules/hummus/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/abcd/Library/Caches/node-gyp/15.8.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/abcd/Library/Caches/node-gyp/15.8.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/abcd/Library/Caches/node-gyp/15.8.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/abcd/Desktop/project/project_l_api/node_modules/hummus',
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: Undefined variable module_name in binding.gyp while trying to load binding.gyp
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 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:378:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 19.6.0
npm ERR! gyp ERR! command "/usr/local/Cellar/node/15.8.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/abcd/Desktop/project/project_l_api/node_modules/hummus
npm ERR! gyp ERR! node -v v15.8.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
Also noticed that sometimes the error message indicates the issue with sqlite3 instead of hummus.
Could not get an exact clue to start, I tried to reinstall the npm and the gyp but the problem still persists.

run npm update and npm install after.
it worked for me.

Related

Errors during installation brain.js

I have had a problem with the brain.js installation for a few days. I don't know if linux on chromebooks doesn't have all the things installed, or if I need to install something
I type: npm i brain.js
output:
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 /home/rudzix66/AI/node_modules/gl
npm ERR! command failed
npm ERR! command sh /tmp/install-36c7d555.sh
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#7.1.2
npm ERR! gyp info using node#16.17.1 | linux | x64
npm ERR! gyp info find Python using Python version 3.10.7 found at "/usr/local/bin/python3"
npm ERR! (node:2816) [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 info spawn /usr/local/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/home/rudzix66/AI/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 '/home/rudzix66/AI/node_modules/gl/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/rudzix66/AI/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/rudzix66/.cache/node-gyp/16.17.1/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=/home/rudzix66/.cache/node-gyp/16.17.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/home/rudzix66/AI/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/rudzix66/.cache/node-gyp/16.17.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/rudzix66/AI/node_modules/gl',
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! /bin/sh: 1: python: not found
npm ERR! gyp: Call to 'python commit_id.py check ..' returned exit status 127 while in angle/src/angle.gyp. while loading dependencies of binding.gyp while trying to load binding.gyp
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 (/home/rudzix66/AI/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 5.10.136-19393-g8d1faf8b57d7
npm ERR! gyp ERR! command "/usr/local/bin/node" "/home/rudzix66/AI/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /home/rudzix66/AI/node_modules/gl
npm ERR! gyp ERR! node -v v16.17.1
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
I use Linux on Chromebook

Trying to run npm install- getting errors

I am following a tutorial on creating an ERC20 and ICO Dapp University ERC20 and ICO
I am trying to run npm install and getting this error -
npm ERR! code 1
npm ERR! path C:\Users\Foxy098\Desktop\Coding\WhiteCryptoICO\node_modules\sha3
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
npm ERR! addon.cpp
npm ERR! C:\Users\Foxy098\AppData\Local\node-gyp\Cache\16.15.0\include\node\node.h(63,10): fatal error C1083: Cannot open include file: 'v8.h': No such file or directory [C:\Users\Foxy098\Desktop\Coding\WhiteCryptoICO\node_modules\sha3\build\sha3.vcxproj]
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#9.0.0
npm ERR! gyp info using node#16.15.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.4 found at "C:\Users\Foxy098\AppData\Local\Programs\Python\Python310\python.exe"
npm ERR! gyp info find VS using VS2022 (17.2.32516.85) found at:
npm ERR! gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Users\Foxy098\AppData\Local\Programs\Python\Python310\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'C:\\Users\\Foxy098\\AppData\\Roaming\\npm\\node_modules\\npm\\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 '-I',
npm ERR! gyp info spawn args 'C:\\Users\\Foxy098\\Desktop\\Coding\\WhiteCryptoICO\\node_modules\\sha3\\build\\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\Foxy098\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\Foxy098\\AppData\\Local\\node-gyp\\Cache\\16.15.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\\Foxy098\\AppData\\Local\\node-gyp\\Cache\\16.15.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\Foxy098\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\Foxy098\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.15.0\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=C:\\Users\\Foxy098\\Desktop\\Coding\\WhiteCryptoICO\\node_modules\\sha3',
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\\Foxy098\\Desktop\\Coding\\WhiteCryptoICO\\node_modules\\sha3\\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'build/binding.sln',
npm ERR! gyp info spawn args '/clp:Verbosity=minimal',
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! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onExit (C:\Users\Foxy098\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Foxy098\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\Foxy098\Desktop\Coding\WhiteCryptoICO\node_modules\sha3
npm ERR! gyp ERR! node -v v16.15.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Foxy098\AppData\Local\npm-cache\_logs\2022-05-26T08_27_58_965Z-debug-0.log
I also tried this : npm install --global windows-build-tools
and I also tried : npm install --global --production windows-build-tools
Still got errors for both.
Any ideas?
I think you installed packages with two different node version.

npm install MyEtherWallet

when installing MyEtherWallet dependencies I get this error output.
why it is? Does it have any implication python version?
the vue version is:
#vue/cli 5.0.4
git clone https://github.com/MyEtherWallet/MyEtherWallet
and then:
npm ci
and with npm install is the same
npm WARN deprecated core-js#2.6.12: core-js#<3.4 is no longer maintained and not
recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path /home/julian/Documentos/MyEhterWallet/MyEtherWallet/node_modules/bcrypto
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#8.4.1
npm ERR! gyp info using node#16.13.2 | linux | x64
npm ERR! gyp info find Python using Python version 3.6.15 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/home/julian/Documentos/MyEhterWallet/MyEtherWallet/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 '/home/julian/Documentos/MyEhterWallet/MyEtherWallet/node_modules/bcrypto/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/julian/Documentos/MyEhterWallet/MyEtherWallet/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/julian/.cache/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=/home/julian/.cache/node-gyp/16.13.2',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/home/julian/Documentos/MyEhterWallet/MyEtherWallet/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/julian/.cache/node-gyp/16.13.2/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/julian/Documentos/MyEhterWallet/MyEtherWallet/node_modules/bcrypto',
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 ERR! build error
npm ERR! gyp ERR! stack Error: not found: make
npm ERR! gyp ERR! stack at getNotFoundError (/home/julian/Documentos/MyEhterWallet/MyEtherWallet/node_modules/node-gyp/node_modules/which/which.js:10:17)
npm ERR! gyp ERR! stack at /home/julian/Documentos/MyEhterWallet/MyEtherWallet/node_modules/node-gyp/node_modules/which/which.js:57:18
npm ERR! gyp ERR! stack at new Promise (<anonymous>)
npm ERR! gyp ERR! stack at step (/home/julian/Documentos/MyEhterWallet/MyEtherWallet/node_modules/node-gyp/node_modules/which/which.js:54:21)
npm ERR! gyp ERR! stack at /home/julian/Documentos/MyEhterWallet/MyEtherWallet/node_modules/node-gyp/node_modules/which/which.js:71:22
npm ERR! gyp ERR! stack at new Promise (<anonymous>)
npm ERR! gyp ERR! stack at subStep (/home/julian/Documentos/MyEhterWallet/MyEtherWallet/node_modules/node-gyp/node_modules/which/which.js:69:33)
npm ERR! gyp ERR! stack at /home/julian/Documentos/MyEhterWallet/MyEtherWallet/node_modules/node-gyp/node_modules/which/which.js:80:22
npm ERR! gyp ERR! stack at /home/julian/Documentos/MyEhterWallet/MyEtherWallet/node_modules/isexe/index.js:42:5
npm ERR! gyp ERR! stack at /home/julian/Documentos/MyEhterWallet/MyEtherWallet/node_modules/isexe/mode.js:8:5
npm ERR! gyp ERR! stack at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp ERR! System Linux 5.3.18-150300.59.68-default
npm ERR! gyp ERR! command "/usr/bin/node16" "/home/julian/Documentos/MyEhterWallet/MyEtherWallet/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /home/julian/Documentos/MyEhterWallet/MyEtherWallet/node_modules/bcrypto
npm ERR! gyp ERR! node -v v16.13.2
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok

Installing ganache in power shell and ran into NPM Err

I am trying to install ganache to my power shell. I rand npm install ganache --global
I ran into the following error:
PS C:\Users\Chetachi Ugwu-Ojobe\Documents\projects\Learning Solidity\Demos> npm install ganache --global
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup [
npm WARN cleanup 'C:\\Users\\Chetachi Ugwu-Ojobe\\AppData\\Roaming\\npm\\node_modules\\ganache\\node_modules',
npm WARN cleanup [Error: EBUSY: resource busy or locked, rmdir 'C:\Users\Chetachi Ugwu-Ojobe\AppData\Roaming\npm\node_modules\ganache\node_modules\bufferutil'] {
npm WARN cleanup errno: -4082,
npm WARN cleanup code: 'EBUSY',
npm WARN cleanup syscall: 'rmdir',
npm WARN cleanup path: 'C:\\Users\\Chetachi Ugwu-Ojobe\\AppData\\Roaming\\npm\\node_modules\\ganache\\node_modules\\bufferutil'
npm WARN cleanup }
npm WARN cleanup ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Users\Chetachi Ugwu-Ojobe\AppData\Roaming\npm\node_modules\ganache\node_modules\leveldown
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
npm ERR! builder.cc
npm ERR! C:\Users\Chetachi Ugwu-Ojobe\AppData\Roaming\npm\node_modules\ganache\node_modules\leveldown\deps\leveldb\port-libuv\port_uv.h(42,10): fatal error C1083: Cannot open include file: 'uv.h': No such file or directory [C:\Users\Chetachi Ugwu-Ojobe\AppData\Roaming\npm\node_modules\ganache\node_modules\leveldown\deps\leveldb\leveldb.vcxproj]
npm ERR! snappy-sinksource.cc
npm ERR! snappy-stubs-internal.cc
npm ERR! snappy.cc
npm ERR! win_delay_load_hook.cc
npm ERR! snappy.vcxproj -> C:\Users\Chetachi Ugwu-Ojobe\AppData\Roaming\npm\node_modules\ganache\node_modules\leveldown\build\Release\\snappy.lib
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#8.4.1
npm ERR! gyp info using node#16.14.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.4 found at "C:\Users\Chetachi Ugwu-Ojobe\AppData\Local\Programs\Python\Python310\python.exe"
npm ERR! gyp info find VS using VS2022 (17.1.32319.34) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Users\Chetachi Ugwu-Ojobe\AppData\Local\Programs\Python\Python310\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'C:\\Users\\Chetachi Ugwu-Ojobe\\AppData\\Roaming\\npm\\node_modules\\npm\\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 '-I',
npm ERR! gyp info spawn args 'C:\\Users\\Chetachi Ugwu-Ojobe\\AppData\\Roaming\\npm\\node_modules\\ganache\\node_modules\\leveldown\\build\\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\Chetachi Ugwu-Ojobe\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\\Users\\Chetachi Ugwu-Ojobe\\AppData\\Local\\node-gyp\\Cache\\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\\Chetachi Ugwu-Ojobe\\AppData\\Local\\node-gyp\\Cache\\16.14.0',npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\Chetachi Ugwu-Ojobe\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\Chetachi Ugwu-Ojobe\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.14.0\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=C:\\Users\\Chetachi Ugwu-Ojobe\\AppData\\Roaming\\npm\\node_modules\\ganache\\node_modules\\leveldown',
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\\Chetachi Ugwu-Ojobe\\AppData\\Roaming\\npm\\node_modules\\ganache\\node_modules\\leveldown\\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'build/binding.sln',
npm ERR! gyp info spawn args '/clp:Verbosity=minimal',
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! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onExit (C:\Users\Chetachi Ugwu-Ojobe\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:520:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Chetachi Ugwu-Ojobe\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\Chetachi Ugwu-Ojobe\AppData\Roaming\npm\node_modules\ganache\node_modules\leveldown
npm ERR! gyp ERR! node -v v16.14.0
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Chetachi Ugwu-Ojobe\AppData\Local\npm-cache\_logs\2022-04-04T20_58_43_266Z-debug-0.log

The command line threw an error while installing JEST with NPM

I just used Vite to initialize a Vue3 + TypeScript project, and then I didn't do anything else. I didn't write a line of code, I didn't modify any files.
I just used this command npm i jest -D directly to install JEST.
But the command line throws an error like this:
$ npm i jest -D
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
npm WARN deprecated node-pre-gyp#0.15.0: Please upgrade to #mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the #mapbox scoped package will recieve updates in the future
npm ERR! code 1
npm ERR! path /Users/apple/Desktop/project/vue3-jest/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#7.1.2
npm ERR! gyp info using node#12.16.1 | darwin | x64
npm ERR! gyp info find Python using Python version 3.9.0 found at "/usr/local/bin/python3"
npm ERR! gyp info spawn /usr/local/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/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/apple/Desktop/project/vue3-jest/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/apple/Library/Caches/node-gyp/12.16.1/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/apple/Library/Caches/node-gyp/12.16.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/apple/Library/Caches/node-gyp/12.16.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/apple/Desktop/project/vue3-jest/node_modules/canvas',
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! /bin/sh: pkg-config: command not found
npm ERR! gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
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 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:311:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
npm ERR! gyp ERR! System Darwin 18.7.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/apple/Desktop/project/vue3-jest/node_modules/canvas
npm ERR! gyp ERR! node -v v12.16.1
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/apple/.npm/_logs/2021-04-26T15_35_01_442Z-debug.log
It makes me helpless. I don't know what the problem is.
I don't know why npm install failed, but yarn work:
yarn add jest --dev
I works for me.