Skip to content

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

@DeeDeeG

Description

@DeeDeeG

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions