본문 바로가기

오늘의 비글링

맥에서 npm install 오류 - gyp: No Xcode or CLT version

맥에서 업데이트된 소스를 package.json 을 반영하기 위해 `npm install`을 실행 시켰더니... 따라~!

gyp: No Xcode or CLT version detected!
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/hyehuympa/.nvm/versions/node/v13.10.1/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:316:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/Users/hyehuympa/.nvm/versions/node/v13.10.1/bin/node" "/Users/hyehuympa/.nvm/versions/node/v13.10.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/hyehuympa/workspace/pharmulator/src/main/front/node_modules/fsevents
gyp ERR! node -v v13.10.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

이러한 문구와 함께 오류가 나타나며 제대로 설치를 해주지 못합니다. 

요는 `gyp: No Xcode or CLT version detected!` 부분인데 Xcode 혹은 CLT를 못찾겠다 라는 뜻입니다. 이럴때는 xcode-select 를 삭제하고 재설치를 해주어야 합니다.

xcode-select 의 설치된 경로 찾기

터미널을 열어 아래의 명령을 사용하면 설치된 경로를 찾을 수 있습니다.

xcode-select --print-path

기본 설정은 `/Library/Developer/CommandLineTools` 경로이지만 혹시 모르니 확인해 보아야 합니다.

xcode-select 삭제하기

앞서 찾아낸 경로를 rm 명령을 통해 삭제하면 됩니다. sudo 명령을 사용하기 때문에 권한을 위해 암호를 입력해야 합니다.

sudo rm -r -f /Library/Developer/CommandLineTools

xcode-select 설치

이제 다시 설치해 주면 모든 과정은 끝납니다. 설치명령을 실행하면 맥 업데이트가 실행되며 설치를 진행합니다.

xcode-select --install

이 명령을 치고 설치확인 창에서 설치를 진행하고 완료되면 앞서 나왔던 오류는 나오지 않고 정상적인 사용이 가능해 집니다.


이제 편안하게 여러분이 하고자 하는걸 진행하시면 됩니다. 

 

[출처] erim1005.tistory.com/entry/%EB%A7%A5%EC%97%90%EC%84%9C-npm-install-%EC%98%A4%EB%A5%98-gyp-No-Xcode-or-CLT-version

 

맥에서 npm install 오류 - gyp: No Xcode or CLT version

맥에서 업데이트된 소스를 package.json 을 반영하기 위해 `npm install`을 실행 시켰더니... 따라~! gyp: No Xcode or CLT version detected! gyp ERR! configure error gyp ERR! stack Error: `gyp` failed wit..

erim1005.tistory.com