NodeJS gyp ERR! find VS msvs_version not set from command line or npm config

 윈도우 환경에서 클레이튼 개발 튜토리얼 중에 CountBApp 개발하기를 따라하던 중 단순히 npm install을 실행한 상황에서 에러가 발생했습니다.

D:\Study\countbapp\node_modules\keccak>if not defined npm_config_node_gyp (node "C:\Users\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )

gyp ERR! find VS 
gyp ERR! find VS msvs_version not 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\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack     at C:\Users\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack     at C:\Users\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
gyp ERR! stack     at C:\Users\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
gyp ERR! stack     at C:\Users\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack     at C:\Users\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:390:5)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at maybeClose (internal/child_process.js:1058:16)
gyp ERR! System Windows_NT 10.0.19043
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\wwfor\\AppData\\Roaming\\nvm\\v14.19.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Study\countbapp\node_modules\keccak
gyp ERR! node -v v14.19.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! keccak@2.1.0 rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the keccak@2.1.0 rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\wwfor\AppData\Roaming\npm-cache\_logs\2022-04-22T01_53_16_298Z-debug.log
"Keccak bindings compilation fail. Pure JS implementation will be used."
> keccak@3.0.2 install D:\Study\countbapp\node_modules\ethereum-cryptography\node_modules\keccak
> node-gyp-build || exit 0

> secp256k1@3.8.0 install D:\Study\countbapp\node_modules\secp256k1
> npm run rebuild || echo "Secp256k1 bindings compilation fail. Pure JS implementation will be used."

> secp256k1@3.8.0 rebuild D:\Study\countbapp\node_modules\secp256k1
> node-gyp rebuild

D:\Study\countbapp\node_modules\secp256k1>if not defined npm_config_node_gyp (node "C:\Users\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! find VS 
gyp ERR! find VS msvs_version not 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\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack     at C:\Users\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack     at C:\Users\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
gyp ERR! stack     at C:\Users\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
gyp ERR! stack     at C:\Users\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack     at C:\Users\wwfor\AppData\Roaming\nvm\v14.19.0\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:390:5)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at maybeClose (internal/child_process.js:1058:16)
gyp ERR! System Windows_NT 10.0.19043
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\wwfor\\AppData\\Roaming\\nvm\\v14.19.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Study\countbapp\node_modules\secp256k1
gyp ERR! node -v v14.19.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! secp256k1@3.8.0 rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the secp256k1@3.8.0 rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\wwfor\AppData\Roaming\npm-cache\_logs\2022-04-22T01_53_19_391Z-debug.log
"Secp256k1 bindings compilation fail. Pure JS implementation will be used."

에러는 발생했지만 중간에 보면 아래와 같이 Pure JS를 사용한다고 하네요. 그래도 뭔가 찜찜합니다.

Keccak bindings compilation fail. Pure JS implementation will be used.
Secp256k1 bindings compilation fail. Pure JS implementation will be used.

로그에 나온데로 Visual Studio 2017 또는 2015, 그 이상 버전을 직접 설치해도 될 듯합니다. 개인적으로는 무거운 비주얼 스튜디오는 이제 설치 안한지 오래되어서 패스하고 윈도우에서 네이티브 노드 모듈 컴파일을 지원하는 빌드 툴 설치용 npm 패키지가 있네요. 파워쉘을 관리자모드로 실행 후 아래와 같이 설치해줍니다.

npm install --global windows-build-tools

PS C:\Windows\system32> npm install --global windows-build-tools

npm WARN deprecated windows-build-tools@5.2.2: Node.js now includes build tools for Windows. You probably no longer need this tool. See https://github.com/felixrieseberg/windows-build-tools for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: 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.
> windows-build-tools@5.2.2 postinstall C:\Program Files\nodejs\node_modules\windows-build-tools
> node ./dist/index.js


Downloading python-2.7.15.amd64.msi
[>                                            ] 0.0% (0 B/s)
Downloaded python-2.7.15.amd64.msi. Saved to C:\Users\wwfor\.windows-build-tools\python-2.7.15.amd64.msi.
Downloading vs_BuildTools.exe
[>                                            ] 0.0% (0 B/s)
Downloaded vs_BuildTools.exe. Saved to C:\Users\wwfor\.windows-build-tools\vs_BuildTools.exe.
Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!
Status from the installers:
---------- Visual Studio Build Tools ----------
Still waiting for installer log file...
------------------- Python --------------------
Successfully installed Python 2.7

로그에도 있듯이 오래 기다려봤는데 반응이 없네요. 깃헙 이슈에 가도 비슷한 이슈가 있어서 아래와 같이 설치하니 일단 설치가 되는 듯 합니다.

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

PS C:\Windows\system32> npm install --global --production windows-build-tools@4.0.0
npm WARN deprecated windows-build-tools@4.0.0: Node.js now includes build tools for Windows. You probably no longer need this tool. See https://github.com/felixrieseberg/windows-build-tools for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: 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.
> windows-build-tools@4.0.0 postinstall C:\Program Files\nodejs\node_modules\windows-build-tools
> node ./dist/index.js


Downloading python-2.7.14.amd64.msi
[============================================>] 100.0% of 20.2 MB (8.96 MB/s)
Downloaded python-2.7.14.amd64.msi. Saved to C:\Users\wwfor\.windows-build-tools\python-2.7.14.amd64.msi.
Downloading BuildTools_Full.exe
[============================================>] 100.0% of 3.29 MB (3.29 MB/s)
Downloaded BuildTools_Full.exe. Saved to C:\Users\wwfor\.windows-build-tools\BuildTools_Full.exe.
Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!
Status from the installers:
---------- Visual Studio Build Tools ----------
Successfully installed Visual Studio Build Tools.
---------- Visual Studio Build Tools ----------
Successfully installed Visual Studio Build Tools.
------------------- Python --------------------
Successfully installed Python 2.7

Could not install Visual Studio Build Tools.
Please find more details in the log files, which can be found at
C:\Users\wwfor\.windows-build-tools
Now configuring the Visual Studio Build Tools and Python...
All done!

msbuild 툴이 설치 되었다고 끝은 아니고 한가지 더 커맨드라인 명령을 아래와 같이 입력해줍니다. 2017은 위 npm 패키지가 msbuild 툴을 2017로 설치를 하고 있는 듯 해서 2017로 했습니다. 혹시 따로 비주얼 스튜디오를 설치하신 분들은 해당 숫자를 사용하시면 됩니다.

npm config set msvs_version 2017 --global

이제 클레이튼 CountBApp 샘플 다시 받아서 npm install 해보니 에러가 없네요.

아무튼 파이썬 2.7에 의존성이 있고 이미 파이썬 3.x를 사용중인데 2.7을 추가로 설치해서 별로 좋아보이진 않습니다. 다음에는 윈도우 패키지 관리자인 Chocolatey로 설치해봐야겠네요.

댓글

이 블로그의 인기 게시물

'xxx.exe' 프로그램을 시작할 수 없습니다. 지정된 파일을 찾을 수 없습니다.

goorm IDE에서 node.js 프로젝트로 Hello World Simple Server 만들어 띄워보기

애드센스 수익을 웨스턴 유니온으로 수표대신 현금으로 지급 받아보자.