Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid comparison tuple and str comparison in xcode_emulation.py #2142

Closed
djcuvcuv opened this issue May 27, 2020 · 3 comments
Closed

Invalid comparison tuple and str comparison in xcode_emulation.py #2142

djcuvcuv opened this issue May 27, 2020 · 3 comments

Comments

@djcuvcuv
Copy link

djcuvcuv commented May 27, 2020

Hi everyone,
This is not urgent, as I've found a workaround, albeit a hacky one, which I've expounded upon below. Thanks in advance for any investigation.

Best,
Chris

  • Node Version:
$ node -v
v13.6.0
$ npm -v
6.13.6
$ node-gyp --version
v6.1.0
  • Platform:
$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.15.4
BuildVersion:	19E287
  • Compiler:
$ cc -v
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
  • Module: npm i appmetrics
Verbose output (from npm or node-gyp):
Traceback (most recent call last):
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 50, in <module>
    sys.exit(gyp.script_main())
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 554, 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 547, in main
    return gyp_main(args)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 532, 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 2215, 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 794, in Write
    extra_mac_bundle_resources, part_of_all)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 900, in WriteActions
    env = self.GetSortedXcodeEnv()
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1885, in GetSortedXcodeEnv
    additional_settings)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1616, in GetSortedXcodeEnv
    additional_settings)
  File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1527, 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 (/usr/local/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.4.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/ccovney/Workspaces/itc-registry-service/src/node_modules/appmetrics
gyp ERR! node -v v13.6.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 

Interestingly, that problematic python function on the ultimate line of the stack trace, namely XcodeVersion() executed on line 1527 returns a tuple, e.g. ('1100', '') and tries to compare it to a string, e.g. '0500', which clearly causes the >= comparison to fail as described in the error message.

Work-around: (Very hacky); On line 1527 of the referenced py file, simply change XcodeVersion() to XcodeVersion()[0] which accesses the version string value.

@richardlau
Copy link
Member

This was fixed by #1939 and released in node-gyp v5.0.6 (the verbose output shows node-gyp v5.0.5 in use).

@cclauss cclauss added the ERR! node-gyp -v < v10.x.x npm install -g npm label May 27, 2020
@cclauss
Copy link
Contributor

cclauss commented May 27, 2020

gyp ERR! node-gyp -v v5.0.5

@richardlau richardlau added the ERR! node-gyp -v < v10.x.x npm install -g npm label May 27, 2020
@djcuvcuv
Copy link
Author

@richardlau @cclauss damn it, rookie mistake. thanks for catching that. i foolishly assumed my global installation was being leveraged, but the module was using an outdated ver. thanks folks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants