Node Application Metrics provides a foundational infrastructure for collecting resource and performance monitoring data for Node.js-based applications.
The Issue: appmetrics appears to be using an outdated version of node-gyp, and the below error returned from node-gyp upon installing appmetrics has been resolved in later (not even the latest) version of node-gyp. For more info: https://github.com/nodejs/node-gyp/issues/2142#issue-626074217
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
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
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.
Again, this has already been resolved in later version of node-gyp. appmetrics should use a version 5.0.6 or later.
no longer confident that this is an issue explicitly from appmetrics. i see dependencies in my usr local dir, which seems to be at fault. apologies for any confusion.
Hi everyone,
The Issue: appmetrics appears to be using an outdated version of node-gyp, and the below error returned from node-gyp upon installing appmetrics has been resolved in later (not even the latest) version of node-gyp. For more info: https://github.com/nodejs/node-gyp/issues/2142#issue-626074217
I've found a workaround, albeit a hacky one, which I've expounded upon below. Thanks in advance for any investigation.
Best, Chris
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, inInterestingly, 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()
toXcodeVersion()[0]
which accesses the version string value.Again, this has already been resolved in later version of node-gyp. appmetrics should use a version 5.0.6 or later.