Sharp: Node 9 (EOL): xcode-select: error: tool 'xcodebuild' requires Xcode,

Created on 14 Jan 2019  路  4Comments  路  Source: lovell/sharp

I dont know why this is happening where i tried to install "sharp" using node and its failing with the following code.

i saw many tickets for this issue has been closed without any proper answer.
would expecting a solution which works for this.

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

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 "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 16, in <module>
    sys.exit(gyp.script_main())
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 545, in script_main
    return main(sys.argv[1:])
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 538, in main
    return gyp_main(args)
  File "/usr/local/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 "/usr/local/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 "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 795, in Write
    self.Pchify))
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1190, in WriteSources
    cflags = self.xcode_settings.GetCflags(configname)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 551, in GetCflags
    archs = self.GetActiveArchs(self.configname)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 420, in GetActiveArchs
    xcode_archs_default = GetXcodeArchsDefault()
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 118, in GetXcodeArchsDefault
    xcode_version, _ = XcodeVersion()
  File "/usr/local/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 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack     at ChildProcess.emit (events.js:127:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/Thilina/github/lamda-avatar-compressor/node_modules/sharp
gyp ERR! node -v v9.6.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

question

Most helpful comment

Hello, this is using Node 9 which reached end-of-life in June last year.

If you're able to use Node 6, 8, 10 or 11 you'll get pre-compiled binaries.

If you want to continue to use Node 9 then you'll need to compile from source and will therefore require xcode, which can be installed via xcode-select --install

https://sharp.pixelplumbing.com/en/stable/install/

All 4 comments

Hello, this is using Node 9 which reached end-of-life in June last year.

If you're able to use Node 6, 8, 10 or 11 you'll get pre-compiled binaries.

If you want to continue to use Node 9 then you'll need to compile from source and will therefore require xcode, which can be installed via xcode-select --install

https://sharp.pixelplumbing.com/en/stable/install/

@lovell Thank you for the detailed answer. is it possible to support for node 9 and above using the pre compiled binaries ? cause im trying to use this one on cloud so it will be an issue with those environments .

Pre-compiled binaries are provided for maintained versions of Node, which includes 10 and 11. I'd recommend you use a LTS version of Node such as 10.

Thank you for your valuable comment. i will go with LTS version

Was this page helpful?
0 / 5 - 0 ratings