Home > Back-end >  xcode-select: error: tool 'xcodebuild' requires Xcode
xcode-select: error: tool 'xcodebuild' requires Xcode

Time:07-03

I am trying to migrate my Angular application from v4.4.6 to v14.0.4. I have conducted the following steps successfully :

 % rm -rf node_modules
 % npm update --loglevel verbose
 % npm install --loglevel verbose
 % nvm install 8.9.4
 % nvm use 8.9.4
 % nvm alias default 8.9.4
 % npm uninstall -g @angular/cli
 % npm install -g @angular/[email protected] --loglevel verbose
 % npm install --save-dev @angular/[email protected] --loglevel verbose

But once I tried to run the following command line, I got this error :

 % NG_DISABLE_VERSION_CHECK=1 npx @angular/[email protected] update @angular/[email protected] --loglevel verbose
    xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
    
    Traceback (most recent call last):
      File "/Users/userx/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 16, in <module>
        sys.exit(gyp.script_main())
      File "/Users/userx/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 545, in script_main
        return main(sys.argv[1:])
      File "/Users/userx/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 538, in main
        return gyp_main(args)
      File "/Users/userx/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 523, in gyp_main
        generator.GenerateOutput(flat_list, targets, data, params)
      File "/Users/userx/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2170, in GenerateOutput
        part_of_all=qualified_target in needed_targets)
      File "/Users/userx/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 817, in Write
        mac_bundle_deps, extra_outputs, part_of_all)
      File "/Users/userx/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1453, in WriteTarget
        lambda p: Sourceify(self.Absolutify(p)))
      File "/Users/userx/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 809, in GetLdflags
        archs = self.GetActiveArchs(self.configname)
      File "/Users/userx/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 420, in GetActiveArchs
        xcode_archs_default = GetXcodeArchsDefault()
      File "/Users/userx/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 118, in GetXcodeArchsDefault
        xcode_version, _ = XcodeVersion()
      File "/Users/userx/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1265, in XcodeVersion
        version = re.match(r'(\d\.\d\.?\d*)', version).groups()[0]
    AttributeError: 'NoneType' object has no attribute 'groups'
    gyp ERR! configure error 
    gyp ERR! stack Error: `gyp` failed with exit code: 1
    gyp ERR! stack     at ChildProcess.onCpExit (/Users/userx/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
    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 Darwin 21.3.0
    gyp ERR! command "/Users/userx/.nvm/versions/node/v8.9.4/bin/node" "/Users/userx/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
    gyp ERR! cwd /Users/userx/.npm/_npx/22018/lib/node_modules/@angular/cli/node_modules/fsevents
    gyp ERR! node -v v8.9.4
    gyp ERR! node-gyp -v v3.6.2
    gyp ERR! not ok 

I double checked xCode and have found it already installed on my mac.

For info :

% ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 6.2.9
Node: 8.9.4
OS: darwin x64
Angular: 4.4.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, tsc-wrapped

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.8.9
@angular-devkit/core         0.8.9
@angular-devkit/schematics   0.8.9
@angular/cli                 6.2.9
@schematics/angular          0.8.9
@schematics/update           0.8.9
rxjs                         5.5.12
typescript                   2.4.2

Any idea how to fix this issue please.

CodePudding user response:

Found the solution to my problem finally :

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

Source

  • Related