npm 설치 실행 중 Node-gyp 오류

npm 설치 실행 중 Node-gyp 오류

npm install 실행 중 오류가 발생했습니다.

C:\cygwin64\home\kjeeva\ANSYSDev\Licensing194\LicensingPortal\node_modules\strong-ursa>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\kjeeva\AppData\Local\Programs\Python\Python37-32\python.exe -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:970:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\cygwin64\home\kjeeva\ANSYSDev\Licensing194\LicensingPortal\node_modules\strong-ursa
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

답변1

node-gyp에는 Python 2가 필요한 것 같습니다.

먼저 Python 2를 다운로드한 후 노드가 사용하는 Python 버전을 다음과 같이 설정합니다.

npm config set python /usr/bin/python2.7

더 많은 정보:https://github.com/nodejs/node-gyp/issues/1651

관련 정보