Skip to content
New issue

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

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

Already on GitHub? # to your account

Doesn't install on machines using Python 3.12 #913

Open
somewhatabstract opened this issue Dec 15, 2023 · 0 comments
Open

Doesn't install on machines using Python 3.12 #913

somewhatabstract opened this issue Dec 15, 2023 · 0 comments
Labels
api: cloudprofiler Issues related to the googleapis/cloud-profiler-nodejs API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@somewhatabstract
Copy link

somewhatabstract commented Dec 15, 2023

The version of node-gyp doesn't support Python 3.12. Note that just updating to v10 brings in a new version of string-width that is ESM only and causes a different issue during pprof building, depending on other dependencies.

Environment details

  • OS: Ubuntu 22.04.3
  • Node.js version: 20.10.0
  • npm version: 10.2.5
  • @google-cloud/profiler version: 6.0.0

Steps to reproduce

  1. Use Python 3.12 (this is default in the Ubuntu 22.04.3 GitHub Actions OS image)
  2. Install @google-cloud/profiler
  3. [Problem ->] See error about missing module (this is due to it being removed in Python 3.12 release)
  4. Pin to node-gyp 10
  5. [Subsequent problem ->] Things should work - however, some code then has conflicts on the version of the string-width module and so errors like this can appear:
  khan/wonder-stuff/node_modules/wide-align/align.js:2
var stringWidth = require('string-width')
                  ^

Error [ERR_REQUIRE_ESM]: require() of ES Module khan/wonder-stuff/node_modules/string-width/index.js from khan/wonder-stuff/node_modules/wide-align/align.js not supported.
Instead change the require of index.js in khan/wonder-stuff/node_modules/wide-align/align.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (khan/wonder-stuff/node_modules/wide-align/align.js:2:19) {
  code: 'ERR_REQUIRE_ESM'

I have managed to get something working by pinning node-gyp to v10 and then pinning string-width to v4, but that's not a viable long term solution.

@somewhatabstract somewhatabstract added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Dec 15, 2023
@product-auto-label product-auto-label bot added the api: cloudprofiler Issues related to the googleapis/cloud-profiler-nodejs API. label Dec 15, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
api: cloudprofiler Issues related to the googleapis/cloud-profiler-nodejs API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

1 participant