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

EDITED FOR PEOPLE JUST GETTING HERE

See https://github.com/nodejs/node-gyp/issues/569#issuecomment-255589932 and https://github.com/nodejs/node-gyp/issues/569#issuecomment-259421050, the warning can just be ignored. Command Line Tools works fine, you do not need the full Xcode.

See https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md, here and here for more info.

Fix:

xcode-select --install # Install Command Line Tools if you haven't already.
sudo xcode-select --switch /Library/Developer/CommandLineTools # Enable command line tools

then just ignore the warning.

Alternatively if you want you can use the full Xcode.app (if you have it installed) with:

# Change the path if you installed Xcode somewhere else.
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

If your install is failing

There will be other errors nearer the end, almost certainly issues with the module you’re trying to install or a dependency. Please report the error to that project.

If that doesn’t work

Are you seeing this when you run node-gyp rebuild or npm install? If not then it’s nothing to do with node-gyp, raise a bug with the project you’re using.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1633
  • Comments: 151 (20 by maintainers)

Commits related to this issue

Most upvoted comments

This fixed it for me:

  1. Install Xcode
  2. Run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

See this explanation on SO.


EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.


Common Problems:

  • Error: xcode-select: error: tool ‘xcodebuild’ requires Xcode, but active developer directory is a command line tools instance
  • whether or not you installed XCode beta

Here’s all the answers from this thread and links compiled into one.

  1. Install Xcode or Xcode-beta
  2. Initiate Spotlight Search and type Xcode (Note whether you see Xcode, Xcode-beta, Xcode-87…)
  3. CMD+enter to open Xcode’s directory
  4. Open Xcode and Accept Terms and Conditions
  5. Move Xcode to /Applications directory ← NOT /Users/{user}/Applications
  6. Open Terminal
    • Xcode-beta: sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
    • Xcode: sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
    • Other: Get the proper path to your Xcode app. If yours is Xcode-87, then it would be: sudo xcode-select --switch /Applications/Xcode-87.app/Contents/Developer

Tested on

  • Macbook Pro, El Capitan OS X 10.11.6

Same answer as @jfmercer . But if you installed XCode beta, use this command instead: sudo xcode-select -s /Applications/Xcode-Beta.app/Contents/Developer

Is there no way to not use xcodebuild? I don’t want to waste 6GB of disk on pointless crap


EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

For users of macOS 10.14 Mojave

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

update node-gyp solved for me $ [sudo] npm explore npm -g – npm install node-gyp@latest

@alejandroiglesias, try this: download Xcode from the app store, open it and accept the license/terms agreement, and try whatever you were doing again.


EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

I do not want install xcode, it’s stupid. How can i do


EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

For those on Mojave, the following worked for me:

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

There’s also a GUI way to solve this.

  1. Start Xcode
  2. Go into Preferences -> Locations
  3. Under Command Line Tools, select your Xcode from the dropdown

The above command line ones did not work for me on Mojave 10.14.4 & Xcode 10.2.

After the latest High Sierra Command Line Tools update for Xcode 10.0, I needed to uninstall my command line tool: $ rm -rf /Library/Developer/CommandLineTools

Then reinstall them using the commands at the top of this forum. Researched for hours and that’s all I could find that would fix my issue. I also don’t have Xcode installed.

EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.


You just need to configure xcode after installation: Open your xcode > go to preferences > select locations tab > select command line tools > set latest xcode version.

xcode-config

The issue was solved after updating npm:

npm install -g npm@latest

I just reinstall xcode-select by running

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

Solved the gyp issue for me

@vedmant I just tried, and I am able to build with node-gyp using the Command Line tools instance. I still see these warning messages, but the node-gyp build did work.

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

Commands I used were:

  • Install command line tools: xcode-select --install
  • Switch to using (already installed) command line tools: sudo xcode-select --switch /Library/Developer/CommandLineTools
  • Show which version you’re currently using: xcode-select -p
    • Mine was /Library/Developer/CommandLineTools

Could you give an example of something that didn’t work for you?

Hi, This work for me: $ sudo rm -rf /Library/Developer/CommandLineTools $ xcode-select --install

Try sudo xcode-select -r. This command worked for me.

@nitinnain if i use your command i get xcode-select: error: invalid developer directory ‘/Applications/Xcode-Beta.app/Contents/Developer’ i have Xcode7 beta 6 :S

Why should this force an installation of the overbloated xcode instead of xcode command line tools?


EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

@dharmanibc xcode-select -print-path

So there is no way without full XCode installation? I don’t want to waste disk space on something I will never use.


EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.


This problem happens when xcode-select developer directory was pointing to /Library/Developer/CommandLineTools, when a full regular XCode was required (happens when CLT are installed after XCode)

Solution:

Install Xcode (get it from https://developer.apple.com/xcode/) if you don't have it yet,

Point xcode-select to the Xcode Developer directory using the following command:

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

Note: Make sure your Xcode app directory is the same as in the address above; most notably, it’ll be probably /Applications/Xcode-Beta.app/Contents/Developeror /Applications/Xcode-beta.app/Contents/Developer if you installed beta XCode release instead.

The Source: http://stackoverflow.com/questions/17980759/xcode-select-active-developer-directory-error/17980786#17980786

update node-gyp solved for me $ [sudo] npm explore npm -g – npm install node-gyp@latest

helped for me! mojave.

To fix this, all I had to do was sudo xcode-select -r This rests to the default command line tools path

im having this problem what is the password when you do sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

@jesstomo12 your sudo password

This is frustrating to say the least, we are in 2017 and still this error showing up. I have gcc installed from Homebrew. I do not need Xcode command line tools.


EDIT(gibfahn): Homebrew requires the Xcode Command Line tools.

Agreed with @wmertens

@Tibicenas @nitinnain - same here: xcode-select: error: invalid developer directory ‘/Applications/Xcode-Beta.app/Contents/Developer’

@npny’s digging is right on the money. Here’s the relevant node-gyp issue.

Xcode Command Line Tools v10.0 (mine landed on my box Sep 17) appears to be incompatible with node-gyp@3.6.2, used by node@8.11.2. I bumped to node@8.12.0 (latest LTS), which pulls node-gyp up to 3.8.0.

npm rebuild <your-busted-package-here> works again \o/

you can always do a xcode-select -r if you already have command line tools or Xcode already installed.

Uninstall the CLT:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

This will reinstall:

image

So there is no way to get around this other than installing a 6GB XCode application? Are you kidding me? I don’t see the point here.


EDIT(gibfahn): No, Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

used nvm to install and switch to node version 8.9.3 installed xcode: xcode-select --install accepted the xcode license sudo xcodebuild -license space space space… agree updated npm to latest npm install -g npm@latest finally both node-gyp rebuild and npm install worked fine 😅

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer worked for me on macOS Mojave 10.14.4 with node.js 8.10

This fixed it for me:

  1. Install Xcode
  2. Run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

See this explanation on SO.

EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

This is the ticket, folks. I’m running macOS 10.14.2.

update node-gyp solved for me $ [sudo] npm explore npm -g – npm install node-gyp@latest

Solved the issue for me

@patrickcat when I try to run sudo xcodebuild -license accept, I get the following:

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

This is INCORRECT. I am running the latest MacOS Catalina, and the full XCode is required: $ xcodebuild xcode-select: error: tool ‘xcodebuild’ requires Xcode, but active developer directory ‘/Library/Developer/CommandLineTools’ is a command line tools instance

What is the bloody point of having command line tools that require the full blown near 10GB GUI??

OS: Mojave 10.14.6 Xcode version: 11.3

As of Jan 2020, for xcode-select to work, it needs to point to xcode.app’s location. When I downloaded xcode from developer page, it was directly unpacked in ‘Downloads’ folder. So, I changed the path to point to downloads folder like so:

sudo xcode-select -switch /Users/(yourUserNameHere)/Downloads/Xcode.app/Contents/Developer

And Boom! It worked after so much struggle. Hope this helps someone.

For those who come here from google This also helps in some cases

rm -rf node_modules
rm package-lock.json
npm cache clean
npm install

If you’re on the new Mojave beta versions (at least) the trick was to completely reset the xcode-select settings using xcode-select -r.

I know this is not the best place for it; but this is the top result on Google, so hopefully this helps other people landing here due to a yarn installor npm install error:

For me, on OSX 10.13.6 High Sierra, node 10.6.0 and npm 6.1.0, this was due to the slightly outdated 3.6.2 version of node-gyp shipped with npm.

TL;DR, I fixed it with

cd /usr/local/Cellar/node/10.6.0/libexec/lib/node_modules/npm/ && npm update node-gyp

Root cause seems to be XcodeVersion() throwing up:

gyp info using node-gyp@3.6.2
gyp info using node@10.6.0 | darwin | x64

[...]

Traceback (most recent call last):

  File "/usr/local/Cellar/node/10.6.0/libexec/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 16, in <module>

[...]

  File "/usr/local/Cellar/node/10.6.0/libexec/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 118, in GetXcodeArchsDefault
    xcode_version, _ = XcodeVersion()

  File "/usr/local/Cellar/node/10.6.0/libexec/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'

As logged above, this happens with node-gyp v3.6.2, but the above regex bug was fixed in v3.6.3:

2  gyp/pylib/gyp/xcode_emulation.py
@@ -1262,7 +1262,7 @@ def XcodeVersion():
   except:
     version = CLTVersion()
     if version:
-      version = re.match(r'(\d\.\d\.?\d*)', version).groups()[0]
+      version = re.match(r'(\d+\.\d+\.?\d*)', version).groups()[0]
     else:
       raise GypError("No Xcode or CLT version detected!")
     # The CLT has no build information, so we return an empty string.

I double-checked that my node and npm were the latest version, but sadly as it turns out npm 6.1.0 still tracks node-gyp 3.6.2.


Therefore, I artifically upgraded

/usr/local/Cellar/node/10.6.0/libexec/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js -v
# v3.6.2

By running

cd /usr/local/Cellar/node/10.6.0/libexec/lib/node_modules/npm/
npm update node-gyp

To get to

/usr/local/Cellar/node/10.6.0/libexec/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js -v
# v3.7.0

At which point I could run my yarn install again without issue.

I have the same error: “xcode-select: error: invalid developer directory ‘/Applications/Xcode.app/Contents/Developer’” I also tried: 1. Install Xcode 2. Run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer or Run sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer Nothing works. How I know which version of Xcode is loaded?

It Worked! You guys rock. Thanks!

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


EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

@Tibicenas @dbranchini did either of you try my suggestion?

The Downloads folder is not a good place to store apps.

From https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md

  • sudo rm -rf $(xcode-select -print-path) # Enter root password. No output is normal.
  • xcode-select --install

For the record, as @dpnishant commented

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer worked for me on macOS Catalina (Beta) as of today

In addition to @jfmercer’s perfect answer, make sure you’ve accepted the license too.

$ sudo xcodebuild -license

None of the suggestions above worked for me. It turns out I needed to update npm from 5.6.0 to 6.4.1, which I did with npm i -g npm. After that, running yarn worked correctly and this issue was gone. Indeed, this comment suggests just that, referring to #1370 (“gyp: don’t print xcodebuild not found errors”):

Once you update to a version of npm that has a version of node-gyp that has that commit then the warning will go away.

In case it helps, I was setting up a project that required "node": ">=8.0 <10", and had installed it with nvm install 9.

I already have Xcode so I removed CommandLineTools and linked Xcode. Thoughts?

$ sudo rm -rf /Library/Developer/CommandLineTools
$ sudo xcode-select --switch /Applications/Xcode.app

xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

So basically everyone seems ok with installing a 5G file just to get xcode, for the sole purpose of getting node-gyp to compile (even though gcc is already installed through the command line tool)

can’t believe this still happening late 2017.


EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

Nice! sudo xcode-select -s /Applications/Xcode.app/Contents/Developer It works good for me on Mac OS X El Capitan…


EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

So, I just want to confirm this.

node-gyp has a hard dependency on XCode (the entire IDE) that cannot be fulfilled by CommandLineTools?


EDIT(gibfahn): No, Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

I just reinstall xcode-select by running

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

Solved the gyp issue for me

Just upgraded MacOS today, together with an xcode update. I guess somehow that upgrade broke xcode command line tools…

OS: version 10.14.5 (18F132) xcode-select: version 2354 Remove and reinstall xcode-select did not resolve this problem on my machine 😭 I installed the latest version of npm too, who else got the same problem with me?

From https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md

  • sudo rm -rf $(xcode-select -print-path) # Enter root password. No output is normal.
  • xcode-select --install

I had an existing installation of the CLI tools. (macOS 10.15.2) After deleting the tools and running the install command, a dialog will prompt that it’s installing. 👉 NOTE: At the same time you’ll get a notification that “Updates are available” – do not dismiss.

After the first installation completes, the tools are not available:

xcode-select -p
xcode-select: error: unable to get active developer directory, use `sudo xcode-select --switch path/to/Xcode.app` to set one (or see `man xcode-select`)

Proceed to accept installing the update from the notification. This process took a bit longer.

After that the path is set:

xcode-select -p
/Library/Developer/CommandLineTools

I’m still getting the error below on macOS Mojave. I have the command line tools, and installing Xcode is not an option for me at the moment because my internet connection is unstable and slow.

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

@skylarweaver This worked ☝️

It works with me on macOS High Sierra, thanks a lot!

I have a simple fix that may be of help when installing Xcode beta for some reason in stays in your downloads folder if you just move it to your application folder that may solve the problem worked for me


EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

I think xcode-select --install attaches itself to the node version you have installed at the time. So if you’re using nvm, asdf or similar, the install process will be linked to the current Node version, and will break if you switch to another version.

EDITED FOR PEOPLE JUST GETTING HERE

See #569 (comment) and #569 (comment), the warning can just be ignored. Command Line Tools works fine, you do not need the full Xcode.

See here and here for more info.

Fix:

xcode-select --install # Install Command Line Tools if you haven't already.
sudo xcode-select --switch /Library/Developer/CommandLineTools # Enable command line tools

then just ignore the warning.

Alternatively if you want you can use the full Xcode.app (if you have it installed) with:

# Change the path if you installed Xcode somewhere else.
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

If your install is failing

There will be other errors nearer the end, almost certainly issues with the module you’re trying to install or a dependency. Please report the error to that project.

If that doesn’t work

Are you seeing this when you run node-gyp rebuild or npm install? If not then it’s nothing to do with node-gyp, raise a bug with the project you’re using.

You also need to run this:

sudo xcodebuild -license

If your logs look like this:

> node-gyp rebuild
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.

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

this fixed the issue for me

The solution from @eiTanLaVi worked for me, too 👍 OSX Mojave 10.14.3

npm explore npm -g – npm install node-gyp@latest

@eiTanLaVi helped solve the issue for me!

npm explore npm -g – npm install node-gyp@latest

None of the other solutions worked for me, however deleting my package-lock.json and reinstalling npm install allowed it to rebuild correctly.

@vedmant unfortunately no


EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

XCode2: sudo xcode-select -s /Applications/Xcode\ 2.app/Contents/Developer

Pay attention to the "" to escape the space


EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

This stack overflow answer pointed me in the right direction. Hope it helps

https://stackoverflow.com/a/17980786

I was losing my mind with this. Updating from npm v5 to npm v6 fixed it, for reasons I’m not entirely sure of. Pretty likely something else was the root cause as surely this package can work with earlier versions of npm.

sudo xcode-select -s … needs to be followed by: sudo xcodebuild license before you ‘make’ or ‘configure’ again.

I write to confirm @davis ’ suggestion, followed by running sudo xcode-select -s /Applications/Xcode.app/Contents/Developer solved it for me.

FYI anyone using a new MacBook or doing a first install of xCode needs to accept the terms/conditions 😉


EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

I don’t think we have any control over the message this prints, it comes out of OSX.

The best resource I’ve seen on this whole mess is actually from a rails documentation project: http://railsapps.github.io/xcode-command-line-tools.html, it’s pretty complete and we’d do well to either link to it or borrow large chunks of it for our own documentation.


EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

But if you installed XCode beta, use this command instead: sudo xcode-select -s /Applications/Xcode-Beta.app/Contents/Developer hah, it’s worked!


EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.

Uninstall the CLT:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

This will reinstall:

image

This one worked for me on a brand new install of Catalina

I’m getting this error on Mojave with node 13.1.0, npm 6.12.1 and yarn 1.19.1

$ yarn
yarn install v1.19.1
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
[5/5] 🔨  Building fresh packages...
[1/7] ⠈ node-lmdb
[-/7] ⠈ waiting...
[-/7] ⠈ waiting...
[-/7] ⠈ waiting...
error /Users/myuser/Desktop/core-js/node_modules/node-lmdb: Command failed.
Exit code: 1
Command: prebuild-install || node-gyp rebuild
Arguments: 
Directory: /Users/myuser/Desktop/core-js/node_modules/node-lmdb
Output:
prebuild-install WARN install No prebuilt binaries found (target=13.1.0 runtime=node arch=x64 libc= platform=darwin)
gyp info it worked if it ends with ok
gyp info using node-gyp@6.0.1
gyp info using node@13.1.0 | darwin | x64
gyp info find Python using Python version 3.7.4 found at "/usr/local/opt/python/bin/python3.7"
gyp info spawn /usr/local/opt/python/bin/python3.7
gyp info spawn args [
gyp info spawn args   '/Users/myuser/.nvm/versions/node/v13.1.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/myuser/Desktop/core-js/node_modules/node-lmdb/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/myuser/.nvm/versions/node/v13.1.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/myuser/Library/Caches/node-gyp/13.1.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/myuser/Library/Caches/node-gyp/13.1.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/myuser/.nvm/versions/node/v13.1.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/myuser/Library/Caches/node-gyp/13.1.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/myuser/Desktop/core-js/node_modules/node-lmdb',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CC(target) Release/obj.target/node-lmdb/dependencies/lmdb/libraries/liblmdb/mdb.o
  CC(target) Release/obj.target/node-lmdb/dependencies/lmdb/libraries/liblmdb/midl.o
  CXX(target) Release/obj.target/node-lmdb/src/node-lmdb.o
  CXX(target) Release/obj.target/node-lmdb/src/env.o
../src/env.cpp:139:7: warning: field 'actions' will be initialized after field 'actionCount' [-Wreorder]
      actions(actions),
      ^
../src/env.cpp:141:7: warning: field 'putFlags' will be initialized after field 'env' [-Wreorder]
      putFlags(putFlags),
      ^
../src/env.cpp:166:13: warning: unused variable 'getCount' [-Wunused-variable]
        int getCount = 0;
            ^
../src/env.cpp:239:13: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
            resultsArray->Set(context, resultIndex, Nan::New<Number>(results[resultIndex]));
            ^~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/env.cpp:401:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    obj->Set(context, Nan::New<String>("pageSize").ToLocalChecked(), Nan::New<Number>(stat.ms_psize));
    ^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/env.cpp:402:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    obj->Set(context, Nan::New<String>("treeDepth").ToLocalChecked(), Nan::New<Number>(stat.ms_depth));
    ^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/env.cpp:403:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    obj->Set(context, Nan::New<String>("treeBranchPageCount").ToLocalChecked(), Nan::New<Number>(stat.ms_branch_pages));
    ^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/env.cpp:404:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    obj->Set(context, Nan::New<String>("treeLeafPageCount").ToLocalChecked(), Nan::New<Number>(stat.ms_leaf_pages));
    ^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/env.cpp:405:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    obj->Set(context, Nan::New<String>("entryCount").ToLocalChecked(), Nan::New<Number>(stat.ms_entries));
    ^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/env.cpp:429:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    obj->Set(context, Nan::New<String>("mapAddress").ToLocalChecked(), Nan::New<Number>((uint64_t) envinfo.me_mapaddr));
    ^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/env.cpp:430:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    obj->Set(context, Nan::New<String>("mapSize").ToLocalChecked(), Nan::New<Number>(envinfo.me_mapsize));
    ^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/env.cpp:431:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    obj->Set(context, Nan::New<String>("lastPageNumber").ToLocalChecked(), Nan::New<Number>(envinfo.me_last_pgno));
    ^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/env.cpp:432:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    obj->Set(context, Nan::New<String>("lastTxnId").ToLocalChecked(), Nan::New<Number>(envinfo.me_last_txnid));
    ^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/env.cpp:433:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    obj->Set(context, Nan::New<String>("maxReaders").ToLocalChecked(), Nan::New<Number>(envinfo.me_maxreaders));
    ^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/env.cpp:434:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    obj->Set(context, Nan::New<String>("numReaders").ToLocalChecked(), Nan::New<Number>(envinfo.me_numreaders));
    ^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/env.cpp:694:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    exports->Set(Nan::GetCurrentContext(), Nan::New<String>("Env").ToLocalChecked(), envTpl->GetFunction(Nan::GetCurrentContext()).ToLocalChecked());
    ^~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16 warnings generated.
  CXX(target) Release/obj.target/node-lmdb/src/misc.o
../src/misc.cpp:34:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    versionObj->Set(context, Nan::New<String>("versionString").ToLocalChecked(), Nan::New<String>(str).ToLocalChecked());
    ^~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/misc.cpp:35:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    versionObj->Set(context, Nan::New<String>("major").ToLocalChecked(), Nan::New<Integer>(major));
    ^~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/misc.cpp:36:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    versionObj->Set(context, Nan::New<String>("minor").ToLocalChecked(), Nan::New<Integer>(minor));
    ^~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/misc.cpp:37:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    versionObj->Set(context, Nan::New<String>("patch").ToLocalChecked(), Nan::New<Integer>(patch));
    ^~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/misc.cpp:39:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    exports->Set(context, Nan::New<String>("version").ToLocalChecked(), versionObj);
    ^~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/misc.cpp:45:46: error: no viable conversion from 'Local<v8::Context>' to 'v8::Isolate *'
    if (opt->IsBoolean() ? opt->BooleanValue(context).ToChecked() : defaultValue) {
                                             ^~~~~~~
/Users/myuser/Library/Caches/node-gyp/13.1.0/include/node/v8.h:2648:30: note: passing argument to parameter 'isolate' here
  bool BooleanValue(Isolate* isolate) const;
                             ^
../src/misc.cpp:249:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    err.As<Object>()->Set(Nan::GetCurrentContext(), Nan::New("code").ToLocalChecked(), Nan::New(rc));
    ^~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/misc.cpp:285:11: warning: extra tokens at end of #endif directive [-Wextra-tokens]
    #endif;
          ^
          //
7 warnings and 1 error generated.
make: *** [Release/obj.target/node-lmdb/src/misc.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/myuser/.nvm/versions/node/v13.1.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.0.0
gyp ERR! command "/Users/myuser/.nvm/versions/node/v13.1.0/bin/node" "/Users/myuser/.nvm/versions/node/v13.1.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/myuser/Desktop/core-js/node_modules/node-lmdb

@davis @gibfahn Considering this page comes up in Google searches, can we update the issue description for the latest versions of macOS?

For anyone having an issue where node-gyp is trying to install an older version (older than 3.6.3 roughly), and it keeps failing, and you may think there’s an issue with Python or Xcode…use the command in this article to rebuild the native node-gyp: https://github.com/nodejs/node-gyp/wiki/Updating-npm’s-bundled-node-gyp

I did actually need to install XCode, and that solved all my problems.

if make failed while you do rebuild, try npm audit fix

FWIW this error was a “red herring” for me. A simple brew upgrade npm fixed it

If you’re on the new Mojave beta versions (at least) the trick was to completely reset the xcode-select settings using xcode-select -r.

Also works with fresh install macos 10.14, but has to run sudo xcode-select -r to run it as root - that was needed.

I had to update node-gyp and add it as a dev dependency for this to work after selecting xcode command line tool

# Install Command Line Tools if you haven't already.
# Enable command line tools
# update node-gyp

xcode-select --install
sudo xcode-select --switch /Library/Developer/CommandLineTools

npm i -D node-gyp

@skylarweaver This worked for me. THANK YOU.

Used command ‘sudo xcodebuild -license accept’ to accept the license.

Thank you. This is helpful.

@vb2807 note these lines:

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

gyp info ok
gyp info it worked if it ends with ok

The gyp info ok means that the gyp part succeeded, the error is the bit that comes later:

../src/node/ext/call.cc:616:20: error: no member named 'SetHiddenValue' in 'v8::Object'
info.This()->SetHiddenValue(Nan::New("channel_").ToLocalChecked(),

Which as @bnoordhuis points out, is an error with the grpc module.

EDIT(gibfahn): Command line tools is fine, you don’t need the full Xcode. Just ignore the warning. See here and here for more info.


I agree that it’s utterly frustrating to have to install 6GB of XCode. The Ruby on Rails documentation that was linked earlier in this thread states:

You don’t need the full Xcode package to get the Xcode Command Line Tools. You only need the full Xcode package if you are doing development of applications for the Apple operating systems.

That seems like a reasonable approach. Any reasons why this should be different for nodejs? Not flaming but genuinely interested in technical reasons.

I also get the error… however verifying my settings… [fireheadman@demon ~ 613]$ sudo xcode-select --switch /Library/Developer/CommandLineTools [fireheadman@demon ~ 615]$ xcode-select -p /Library/Developer/CommandLineTools

I was able to ignore the error and homebridge (in my case) works fine without needing the full Xcode install.