'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 [email protected]
npm ERR! gyp info using [email protected] | 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


Sources

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

Source: Stack Overflow

Solution Source