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

Debian Stretch-based images (including the default major version tags) ship with an older Python 3, which is incompatible with the latest node-gyp@8 #1550

Closed
DeeDeeG opened this issue Aug 21, 2021 · 1 comment

Comments

@DeeDeeG
Copy link

DeeDeeG commented Aug 21, 2021

Environment

Expected Behavior

Python 3 on the official NodeJS Docker images should be new enough to run node-gyp@8 (should be Python 3.6 or newer, see nodejs/node-gyp#2333.)

For reference, node-gyp is the most widely-used native (C/C++) code build tool in the NodeJS ecosystem, used to build native code addons for JS Node modules, which are also popularly known as npm packages. node-gyp@8 is the latest major version of node-gyp as of when I'm posting this issue.

Current Behavior

The Debian Stretch-based, default image tags (node:12, node:14, node:16) ship the same Python 3.5.3 that comes with Debian Stretch itself.

That is too old for node-gyp@8; node-gyp@8 rebuild fails due to requiring newer Python than that.

Possible Solution

Add a step to the image definition that adds Python 3.6.x or newer. This should be available as the first python3 on the PATH.

It's possible to do so while still shipping a copy of python3.5 for those who might need it, I suppose.

Steps to Reproduce

$ sudo docker run --rm -it node:14 bash
root@f27b1d9f6da7:/# mkdir fails_to_build && cd fails_to_build
root@f27b1d9f6da7:/fails_to_build# npm install superstring --jobs=MAX
### [builds successfully using npm 6.x's bundled copy of node-gyp@5]
root@f27b1d9f6da7:/fails_to_build# npx node-gyp@latest rebuild --jobs=MAX
### [node-gyp@8 build failure message here due to outdated Python 3.5.3]

Additional Information

The NPM team have been carefully weighing whether to adopt node-gyp@8 in npm@7 and how/when to do so. If they do, that will likely be picked up in the Node 16.x series and newer in due time.

See discussion here: nodejs/node-gyp#2392

If NPM and Node decide to do that soon, it could leave users of the node:16 tag with broken node-gyp@8 --> broken package installs, due to incompatible/outdated Python 3.5.3 shipping in the image.

As mentioned in the above-linked issue, users of the latest pnpm are already affected on the Stretch-based images, as the latest pnpm has already made the jump to bundling node-gyp@8.

@DeeDeeG DeeDeeG changed the title Debian Stretch-based images ship with an older Python 3, which is incompatible with the latest node-gyp@8 Debian Stretch-based images (including the default major version tags) ship with an older Python 3, which is incompatible with the latest node-gyp@8 Aug 21, 2021
@nschonni
Copy link
Member

Duplicate of #1528
We don't ship anything on the images to support building native packages. In the case of Alpine, there isn't any version of Python included

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

No branches or pull requests

2 participants