node-gyp icon indicating copy to clipboard operation
node-gyp copied to clipboard

Error When Installing Packages With NPM

Open Snowplou opened this issue 3 years ago • 1 comments

When I try to install packages using npm, I get this error:

npm ERR! code ENOENT npm ERR! syscall open npm ERR! path C:\Users\john\Documents\VSC\AI\github.com\brainjs\brain.js/package.json npm ERR! errno -4058 npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\john\Documents\VSC\AI\github.com\brainjs\brain.js\package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\john\AppData\Local\npm-cache_logs\2022-07-28T17_03_06_417Z-debug-0.log

C:\Users\john\Documents\VSC\AI>npm install brain.js npm WARN deprecated [email protected]: this library is no longer supported npm WARN deprecated [email protected]: 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 [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142 npm ERR! code 7 npm ERR! path C:\Users\john\Documents\VSC\AI\node_modules\gpu.js\node_modules\gl npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c prebuild-install || node-gyp rebuild 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.5 found at "C:\Users\john\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe" npm ERR! gyp info find VS using VS2017 (15.9.28307.2019) found at: npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools" npm ERR! gyp info find VS run with --verbose for detailed information npm ERR! (node:13012) [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:\Users\john\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args 'C:\Users\john\Documents\VSC\AI\node_modules\gpu.js\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\john\Documents\VSC\AI\node_modules\gpu.js\node_modules\gl\build\config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args 'C:\Users\john\Documents\VSC\AI\node_modules\gpu.js\node_modules\node-gyp\addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args 'C:\Users\john\AppData\Local\node-gyp\Cache\16.14.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\john\AppData\Local\node-gyp\Cache\16.14.2', npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\Users\john\Documents\VSC\AI\node_modules\gpu.js\node_modules\node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\Users\\john\\AppData\\Local\\node-gyp\\Cache\\16.14.2\\<(target_arch)\\node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=C:\Users\john\Documents\VSC\AI\node_modules\gpu.js\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 'C:\Users\john\Documents\VSC\AI\node_modules\gpu.js\node_modules\gl\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! UNCAUGHT EXCEPTION npm ERR! gyp ERR! stack Error: spawn C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\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.22000 npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\john\Documents\VSC\AI\node_modules\gpu.js\node_modules\node-gyp\bin\node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd C:\Users\john\Documents\VSC\AI\node_modules\gpu.js\node_modules\gl npm ERR! gyp ERR! node -v v16.14.2 npm ERR! gyp ERR! node-gyp -v v7.1.2 npm ERR! gyp ERR! Node-gyp failed to build your package. npm ERR! gyp ERR! Try to update npm and/or node-gyp and if it does not help file an issue with the package author.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\john\AppData\Local\npm-cache_logs\2022-07-28T17_03_14_206Z-debug-0.log

What should I do to fix this?

Snowplou avatar Jul 28 '22 17:07 Snowplou

Not sure but... https://github.com/nodejs/node-gyp/search?q=ENOENT&type=issues

cclauss avatar Jul 28 '22 18:07 cclauss

I had the same issue (I am using Mac with M1)

In my case helped:

  1. Delete node_modules npx npkill
  2. change node to the old version (in my case 12 was fine) nvm use 12
  3. install dependencies npm install
  4. change node to current version nvm use 16
  5. update dependencies with new node npm install

kubo550 avatar Mar 15 '23 18:03 kubo550