2

althogh I've searched to get this error solved I couldn't find any proper solution.

Visual Studio 2019 with complete C++ developer tools is installed as well as Python. Anyhow I get this error when I install bcryptjs in VSCode:

gyp ERR! find VS
gyp ERR! find VS msvs_version was set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack     at VisualStudioFinder.fail (C:\Users\BOSS\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack     at findVisualStudio2013 (C:\Users\BOSS\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16)
gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\BOSS\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack     at findVisualStudio2015 (C:\Users\BOSS\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14)
gyp ERR! stack     at regSearchKeys (C:\Users\BOSS\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16)
gyp ERR! stack     at regGetValue (C:\Users\BOSS\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7)
gyp ERR! stack     at C:\Users\BOSS\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:301:5)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:982:16)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\BOSS\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\BOSS\Coding\PROJECTS\UDEMY\NODE.JS BOOTCAMP 2020\natours\node_modules\node-pty
gyp ERR! node -v v10.22.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN natours@1.0.0 No description
npm WARN natours@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-pty@0.9.0 (node_modules\node-pty):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-pty@0.9.0 install: `node scripts/install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

Does anybody know what could be done to get rid of that error? I've set npm config set msvs_version 2019 --global, but I still get VCINSTALLDIR not set, not running in VS Command Prompt and could not use PowerShell to find Visual Studio 2017 or newer

Btw, bcryptjs itself is getting installed but i think without some extras?

When I use yarn the whole compilation process works fine, so I think it's an annoying configuration error that I can't find.

Is there a manual way to set the VS directory? I've tryied this solution https://stackoverflow.com/a/59882818/13609359 but with no success.

Many thanks in advance Slevin

Slevin
  • 617
  • 1
  • 7
  • 17

2 Answers2

0

Well, after struggling around for more than two hours I came up with that solution:

npm install --global --production windows-build-tools

No easy way to find out that you need to install an extra package to get the compilation done (yarn gets it done out of the box as it should be). Hopefully this solution can help others too, as it seems to be a huge problem installing packages that have a compiling process involved.

Slevin
  • 617
  • 1
  • 7
  • 17
0

In my case npm install --global --production windows-build-tools resulted in an infinite loop as i already had visual studio installed.

So i went to my visual studio installer and from the modified option added the Desktop development with C++ (It was not added before). After successful installation all worked fine.

I previously had python installed and was using Visual Studio 2019 Community edition