'"npm install" don't install file node_mdule (node-gyp error)

I have been trying to solve this error for 2 days. I check a lot of solutions inside internet (and stackoverflow) and I'm desperate looking for help.

So, inside my project when I write:

npm install

I had errer:

npm ERR! code 7
npm ERR! path C:\Users\dagma\FinsekaApp\deploy_harveFix2\client\node_modules\iltorb
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node ./scripts/install.js || node-gyp rebuild
npm ERR! info install installing standalone, skipping download.
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! (node:11728) [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 C:\Python27\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\Users\\dagma\\FinsekaApp\\deploy_harveFix2\\client\\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\\dagma\\FinsekaApp\\deploy_harveFix2\\client\\node_modules\\iltorb\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\dagma\\FinsekaApp\\deploy_harveFix2\\client\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\dagma\\.node-gyp\\16.13.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=C:\\Users\\dagma\\.node-gyp\\16.13.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\dagma\\FinsekaApp\\deploy_harveFix2\\client\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\Users\\dagma\\.node-gyp\\16.13.1\\<(target_arch)\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\dagma\\FinsekaApp\\deploy_harveFix2\\client\\node_modules\\iltorb',
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\\dagma\\FinsekaApp\\deploy_harveFix2\\client\\node_modules\\iltorb\\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\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   '/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! 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:282:19)
npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:477: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:\\Program Files\\nodejs\\node.exe" "C:\\Users\\dagma\\FinsekaApp\\deploy_harveFix2\\client\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\dagma\FinsekaApp\deploy_harveFix2\client\node_modules\iltorb
npm ERR! gyp ERR! node -v v16.13.1
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! A complete log of this run can be found in:
npm ERR!     C:\Users\dagma\AppData\Local\npm-cache\_logs\2021-12-12T04_31_50_053Z-debug-0.log

I have installed:

NodeJS: v16.13.1

npm: 8.3.0

python: 3.9.0

Visual Studio 2019



Solution 1:[1]

For those trying to install node-gyp with no internet access:

To setup node headers for node-gyp:

  • Get the node headers file: curl -O https://nodejs.org/dist/v14.17.3/node-v14.17.3-headers.tar.gz (make sure you have the correct node version appropriate, and you need a machine with internet)
  • Copy header tarball to offline machine (approach may vary depending on your situation an example may be to winscp to vm)
  • Create the node-gyp folder that the library looks for if it's not already existing: mkdir -p ~/.cache/node-gyp/14.17.3 (PITFALL: in some versions node-gyp folder is under ~/.node-gyp)
  • tar the file to node-gyp folder: tar -xf node-v14.17.3-headers.tar.gz --directory ~/.cache/.node-gyp/6.10.1/ --strip-components 1 (make sure you have the correct versions here)
  • create the installVersion manually: echo 9 >~/.node-gyp/6.10.1/installVersion (usually it is created automatically if you have internet access)

Solution 2:[2]

Please try using npm init -y first(creates a 'package.json' file that tracks all the dependencies) and then try the npm install command.

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 mel3kings
Solution 2 K G Prajwal