준호씨의 블로그

OSX - npm오류. gyp: No Xcode or CLT version detected! 본문

개발이야기

OSX - npm오류. gyp: No Xcode or CLT version detected!

준호씨 2020. 7. 29. 22:56

OSX환경에서 react 예제 (https://ko.reactjs.org/docs/add-react-to-a-website.html)를 돌려 보는 중 npm으로 모듈을 설치하는 부분이 있어서

$ npm install babel-cli@6 babel-preset-react-app@3

을 실행했더니 아래와 같은 오류가 발생했습니다.

...
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/junho85/.nvm/versions/node/v13.8.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:321: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/junho85/.nvm/versions/node/v13.8.0/bin/node" "/Users/junho85/.nvm/versions/node/v13.8.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/junho85/WebstormProjects/labs/node_modules/fsevents
gyp ERR! node -v v13.8.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
...

이럴 때는 command line tools라는 개발 관련 툴을 설치해 주면 됩니다.

$ xcode-select --install

 

만약 설치가 잘 안되면 지우고 다시 설치하면 되는데요.

아래 명령어로 경로를 확인 한 다음

$ xcode-select --print-path
/Library/Developer/CommandLineTools

해당 경로를 아래와 같은 명령어로 제거하고

$ sudo rm -rf /Library/Developer/CommandLineTools

다시 설치해 주면 됩니다.

$ xcode-select --install

 

Command Line Tools는 macOS에서 커맨드 라인 개발을 할 때 사용하는 여러 툴들입니다. macOS SDK, Clang 등이 있습니다.

$ ll /Library/Developer/CommandLineTools
total 0
drwxr-xr-x  5 root  wheel   160B May  3 13:41 Library
drwxr-xr-x  6 root  wheel   192B Jul 29 17:13 SDKs
drwxr-xr-x  7 root  wheel   224B May  3 13:42 usr

 

$ ll /Library/Developer/CommandLineTools/usr/bin
total 611216
lrwxr-xr-x  1 root  wheel    64B Jul 29 17:07 2to3 -> ../../Library/Frameworks/Python3.framework/Versions/3.8/bin/2to3
lrwxr-xr-x  1 root  wheel    68B Jul 29 17:07 2to3-3.8 -> ../../Library/Frameworks/Python3.framework/Versions/3.8/bin/2to3-3.8
-rwxr-xr-x  1 root  wheel   328K Jul 19 04:20 DeRez
-rwxr-xr-x  1 root  wheel   163K Jul 19 04:20 GetFileInfo
-rwxr-xr-x  1 root  wheel   165K Jul 19 04:20 ResMerger
-rwxr-xr-x  1 root  wheel   330K Jul 19 04:20 Rez
-rwxr-xr-x  1 root  wheel   163K Jul 19 04:20 SetFile
-rwxr-xr-x  1 root  wheel   164K Jul 19 04:20 SplitForks
-rwxr-xr-x  1 root  wheel   166K Jul 19 04:20 ar
-rwxr-xr-x  1 root  wheel   149K Jul 19 04:20 as
-rwxr-xr-x  1 root  wheel   163K Jul 19 04:20 asa
-rwxr-xr-x  1 root  wheel   520K Jul 19 04:20 bison
-rwxr-xr-x  1 root  wheel   407K Jul 19 04:20 bitcode_strip
lrwxr-xr-x  1 root  wheel     5B Jul 29 17:07 c++ -> clang
lrwxr-xr-x  1 root  wheel    12B Jul 29 17:07 c++filt -> llvm-cxxfilt
-rwxr-xr-x  1 root  admin   164K Jul 19 04:20 c89
-rwxr-xr-x  1 root  admin   164K Jul 19 04:20 c99
lrwxr-xr-x  1 root  wheel     5B Jul 29 17:07 cc -> clang
-rwxr-xr-x  1 root  wheel   169M Jul 19 04:20 clang
lrwxr-xr-x  1 root  wheel     5B Jul 29 17:07 clang++ -> clang
-rwxr-xr-x  1 root  wheel    72M Jul 19 04:20 clangd
-rwxr-xr-x  1 root  wheel   342K Jul 19 04:20 cmpdylib
-rwxr-xr-x  1 root  wheel   407K Jul 19 04:20 codesign_allocate
lrwxr-xr-x  1 root  wheel    17B Jul 29 17:07 codesign_allocate-p -> codesign_allocate
-rwxr-xr-x  1 root  admin   3.3K Jul 14 17:18 cpp
-rwxr-xr-x  1 root  wheel   164K Jul 19 04:20 ctags
-rwxr-xr-x  1 root  wheel   407K Jul 19 04:20 ctf_insert
-rwxr-xr-x  1 root  wheel    61M Jul 19 04:20 dsymutil
lrwxr-xr-x  1 root  wheel    14B Jul 29 17:07 dwarfdump -> llvm-dwarfdump
-rwxr-xr-x  1 root  wheel   1.4M Jul 19 04:20 dwarfdump-classic
-rwxr-xr-x  1 root  wheel   496K Jul 19 04:20 dyldinfo
-rwxr-xr-x  1 root  wheel   239B Jul 14 21:45 easy_install-3.8
-rwxr-xr-x  1 root  wheel   680K Jul 19 04:20 flex
-rwxr-xr-x  1 root  wheel   680K Jul 19 04:20 flex++
lrwxr-xr-x  1 root  wheel     3B Jul 29 17:07 g++ -> gcc
-rwxr-xr-x  1 root  wheel   101K Jul 14 21:52 gatherheaderdoc
-rwxr-xr-x  1 root  admin   163K Jul 19 04:20 gcc
lrwxr-xr-x  1 root  wheel     8B Jul 29 17:07 gcov -> llvm-cov
-rwxr-xr-x  1 root  wheel   5.2M Jul 19 04:20 git
...

 

0 Comments
댓글쓰기 폼