미니옵빠의 code stubs

Windows 환경에서 node-gyp build 오류 시 본문

Language/Node.js

Windows 환경에서 node-gyp build 오류 시

미니옵빠 2018. 3. 11. 11:06


Windows 환경에서 node-gyp build 시 오류가 나는 경우가 있음.

node-gyp 으로 모듈을 직접 만드는 경우가 아니라면, 대부분 heapdump 같은 library install 시 만나게 됨


gyp info spawn args [ 'C:\\Program Files (x86)\\Yarn\\node_modules\\node-gyp\\gyp\\gyp_main.py',

gyp info spawn args   'binding.gyp',

gyp info spawn args   '-f',

gyp info spawn args   'msvs',

gyp info spawn args   '-G',

gyp info spawn args   'msvs_version=auto',

gyp info spawn args   '-I',


-- 중략


gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe

gyp info spawn args [ 'build/binding.sln',

gyp info spawn args   '/clp:Verbosity=minimal',

gyp info spawn args   '/nologo',

gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]

이 솔루션의 프로젝트를 한 번에 하나씩 빌드합니다. 병렬 빌드를 사용하려면 "/m" 스위치를 추가하십시오.

MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0".

gyp ERR! build error

gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1

gyp ERR! stack     at ChildProcess.onExit (C:\Program Files (x86)\Yarn\node_modules\node-gyp\lib\build.js:276:23)

gyp ERR! stack     at emitTwo (events.js:126:13)

gyp ERR! stack     at ChildProcess.emit (events.js:214:7)

gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)

gyp ERR! System Windows_NT 10.0.16299

gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files (x86)\\Yarn\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"

gyp ERR! cwd C:\JAVA\IdeaProjects\adhocBatch\node_modules\heapdump

gyp ERR! node -v v8.9.4

gyp ERR! node-gyp -v v3.5.0

gyp ERR! not ok



이 경우 아래와 같이 ms visual studio 버전을 내 PC 버전에 맞춘 뒤, 다시 시도해 보면 됨


npm config set msvs_version 2013 --global


visual studio 라고는 하지만 실제 해당 vs 가 사용하는 .NET Framework 임. 적당히 높은 버전으로 설정



----------


그냥 여기 보고 처음부터 시작하는게 마음 편함 https://github.com/nodejs/node-gyp#on-windows



ref: