skip to Main Content

I am trying to complete a project with javascript for which I need to import a library, however, npm is giving me errors whenever I try to use it.

the error:

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 1
npm ERR! path C:UsersdanieOneDriveDesktopscience fairnode_modulesgl
npm ERR! command failed
npm ERR! command C:Windowssystem32cmd.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.8 found at "C:Python310python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version was set from command line or npm config
npm ERR! gyp ERR! find VS - looking for Visual Studio version 2015
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS unknown version "undefined" found at "D:ApplicationsVS studio"
npm ERR! gyp ERR! find VS checking VS2019 (16.11.32929.386) found at:
npm ERR! gyp ERR! find VS "C:Program Files (x86)Microsoft Visual Studio2019BuildTools"
npm ERR! gyp ERR! find VS - found "Visual Studio C++ core features"
npm ERR! gyp ERR! find VS - found VC++ toolset: v142
npm ERR! gyp ERR! find VS - missing any Windows SDK
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS valid versions for msvs_version:
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack     at VisualStudioFinder.fail (C:UsersdanieOneDriveDesktopscience fairnode_modulesnode-gyplibfind-visualstudio.js:121:47)
npm ERR! gyp ERR! stack     at C:UsersdanieOneDriveDesktopscience fairnode_modulesnode-gyplibfind-visualstudio.js:74:16
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:UsersdanieOneDriveDesktopscience fairnode_modulesnode-gyplibfind-visualstudio.js:351:14)
npm ERR! gyp ERR! stack     at C:UsersdanieOneDriveDesktopscience fairnode_modulesnode-gyplibfind-visualstudio.js:70:14
npm ERR! gyp ERR! stack     at C:UsersdanieOneDriveDesktopscience fairnode_modulesnode-gyplibfind-visualstudio.js:372:16
npm ERR! gyp ERR! stack     at C:UsersdanieOneDriveDesktopscience fairnode_modulesnode-gyplibutil.js:54:7
npm ERR! gyp ERR! stack     at C:UsersdanieOneDriveDesktopscience fairnode_modulesnode-gyplibutil.js:33:16
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:410:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1100:16)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\danie\OneDrive\Desktop\science fair\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:UsersdanieOneDriveDesktopscience fairnode_modulesgl
npm ERR! gyp ERR! node -v v16.18.0
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!     C:UsersdanieAppDataLocalnpm-cache_logs2022-10-16T23_54_51_958Z-debug-0.log

I tried upwards of 20 solutions on this site and none worked for me. Does anyone have any ideas? I tried npm update, reinstalling npm, reinstalling node, etc. I believe it has something to do with visual studio as with this very similar question (How can I fix "npm ERR! code1"), however, I don’t understand what they mean with the answer or what I should do.

EDIT: Forgot to mention I have Visual Studio 2022 already installed on this device, but it is on my D: drive. I didn’t think that was the problem but I am unsure.

2

Answers


  1. Do you use windows os?

    At windows OS, after we install npm on the environtment, we need to add the path to the env list. And also restart the PC to let the system applying the changes.

    Here was a reference for adding the npm path to env.

    Hope it was helpful.

    Thank you

    Login or Signup to reply.
  2. What you need to do is install https://aka.ms/vs/17/release/vs_BuildTools.exe and then in the section "Workloads" > "Desktop & Mobile", then select the box that says "C++ build tools", press it and a list of selections appears, leave it as it is and in the lower right corner appears the "install" button, press it, wait for it to finish and that’s it.

    If it still does not work, log out and log back in to your user account.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search