node-gyp: TypeError: '>=' not supported between instances of 'tuple' and 'str'

  • Node Version: node v10.15.3 npm 6.4.1
  • Platform: Darwin AdamsVoBookPro3 19.0.0 Darwin Kernel Version 19.0.0: Wed Sep 25 20:18:50 PDT 2019; root:xnu-6153.11.26~2/RELEASE_X86_64 x86_64
  • Compiler:
Target: x86_64-apple-darwin19.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
  • Module: electron-rebuild
Verbose output (from npm or node-gyp):
An unhandled error occurred inside electron-rebuild
Traceback (most recent call last):
  File "/Users/adam/Projects/Personal/insomnia/packages/insomnia-app/node_modules/node-gyp/gyp/gyp_main.py", line 50, in <module>
    sys.exit(gyp.script_main())
  File "/Users/adam/Projects/Personal/insomnia/packages/insomnia-app/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 554, in script_main
    return main(sys.argv[1:])
  File "/Users/adam/Projects/Personal/insomnia/packages/insomnia-app/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 547, in main
    return gyp_main(args)
  File "/Users/adam/Projects/Personal/insomnia/packages/insomnia-app/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 532, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "/Users/adam/Projects/Personal/insomnia/packages/insomnia-app/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2215, in GenerateOutput
    part_of_all=qualified_target in needed_targets)
  File "/Users/adam/Projects/Personal/insomnia/packages/insomnia-app/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 802, in Write
    self.WriteCopies(spec['copies'], extra_outputs, part_of_all)
  File "/Users/adam/Projects/Personal/insomnia/packages/insomnia-app/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1145, in WriteCopies
    env = self.GetSortedXcodeEnv()
  File "/Users/adam/Projects/Personal/insomnia/packages/insomnia-app/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1885, in GetSortedXcodeEnv
    additional_settings)
  File "/Users/adam/Projects/Personal/insomnia/packages/insomnia-app/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1618, in GetSortedXcodeEnv
    additional_settings)
  File "/Users/adam/Projects/Personal/insomnia/packages/insomnia-app/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1529, in _GetXcodeEnv
    if XcodeVersion() >= '0500' and not env.get('SDKROOT'):
TypeError: '>=' not supported between instances of 'tuple' and 'str'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/adam/Projects/Personal/insomnia/packages/insomnia-app/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Darwin 19.0.0
gyp ERR! command "/Users/adam/.nvm/versions/node/v10.15.3/bin/node" "/Users/adam/Projects/Personal/insomnia/packages/insomnia-app/node_modules/.bin/node-gyp" "rebuild" "--target=3.1.13" "--arch=x64" "--dist-url=https://electronjs.org/headers" "--build-from-source" "--module_name=node_libcurl" "--module_path=/Users/adam/Projects/Personal/insomnia/packages/insomnia-libcurl/node_modules/insomnia-node-libcurl/lib/binding" "--host=https://github.com/JCMais/node-libcurl/releases/download" "--remote_path=./v2.0.0-alpha.0-1/"
gyp ERR! cwd /Users/adam/Projects/Personal/insomnia/packages/insomnia-libcurl/node_modules/insomnia-node-libcurl
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok

Failed with exit code: 1

If I update the comparison on the line here to the following, it works:

  xcode_version, _ = XcodeVersion()

  if xcode_version >= '0500' and not env.get('SDKROOT'):

However, I’m not sure if it’s supposed to work like that or not.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 6
  • Comments: 32 (11 by maintainers)

Most upvoted comments

A workaround that worked for me was running:

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

Found out about this here: https://github.com/nodejs/node-gyp/wiki/Updating-npm’s-bundled-node-gyp

A workaround that worked for me was running:

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

Found out about this here: https://github.com/nodejs/node-gyp/wiki/Updating-npm’s-bundled-node-gyp

It worked for me as well! 👍

A workaround that worked for me was running:

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

Found out about this here: https://github.com/nodejs/node-gyp/wiki/Updating-npm’s-bundled-node-gyp

work like a charm

Not to detract from the 6.0.1 conversation, because I think that is a good question, but just a quick FYI:

I think node-gyp is mostly needed when building modules from source. Most of the time there should be a binary package available for a given node module in your environment.

In my case, on a mac, node-gyp was trying to build fsevents 1.2.6 or something, because it was an optional child dependency of a dependency ( babel-cli in my case ). fsevents 1.2.9 is the first version compatible with node 12, so npm was failing to find a binary package.

I resolved this issue locally by adding the following to my package.json:

"optionalDependencies": {
    "fsevents": "^1.2.9"
  },

This allowed the binary package for fsevents 1.2.9 to be installed and eliminated the need for node-gyp.

Again, this shouldn’t detract from the node-gyp issue, because it’s still an issue. Just sayin there may be a quick workaround available for many folks.

Anyone know when this will get integrated into NPM? It seems like NPM is still using v5.0.5 of node-gyp, and I don’t seem to be able to find any pull requests for updating node-gyp. I’m unable to install a package right now because NPM is using a broken node-gyp.

The last three comments do not pertain to this issue. Perhaps find the right repo to open a new issue on.

Anyone know when this will get integrated into NPM?

Wrong repo. Check out https://github.com/npm/cli/pull/276#issuecomment-549654698

Sorry about that. I wasn’t finding anything on NPM and wasn’t sure where to post since they don’t have an issues tab and I wasn’t too sure about joining the forum just to ask a single question, so I ended up posting here since it was related to the error I was getting. Thanks for bringing the topic up on the NPM repo for me.

My issue is actually with detect-character-encoding, which I added to a couple of command-line tools I have in NPM. I’ve reverted to the previous version of my tools that doesn’t use it while I wait for NPM to update the node-gyp dependency to fix my issue. It seemed to be an issue on all of the node versions I tried to install it on (8, 10, 12, 13).

Note that when I was implementing the tool changes, I used yarn, but I use NPM for installing packages globally. It worked without any issues in yarn, so I was rather surprised when the global NPM installs failed.

Hi. I have the same error after I updated xCode to the newest version(if it helps).