Skip to content

Older Versions of Node.js Require Downgrading Python 3 to Install Node.js from Source #48130

Closed
@zvakanaka

Description

@zvakanaka

When running nvm install 14 on Apple Silicon (M2), I got the following error message when Node.js 14.21.3 was attempted to be installed from source (since pre-built Apple Silicon versions of Node.js are only available for Node.js 15 and onward, and since it also does not exist in the unofficial builds):

Node.js configure: Found Python 3.11.3...
Please use python3.10 or python3.9 or python3.8 or python3.7 or python3.6 or python3.5 or python2.7.

which python3 showed /opt/homebrew/bin/python3.

I fixed this error and was able to get nvm install 14 to build from source by downgrading Python 3 with pyenv global 3.10.11 2.7.18 (after installing that version with pyenv install 3.10).

For the Future

The configure file within the node-v14.21.3.tar.xz file in the archives is outdated and only checks for up to Python version 3.10.z.

The latest version of the configure file does have support for Python 3.11.z:

node/configure

Line 26 in 959142a

acceptable_pythons = ((3, 11), (3, 10), (3, 9), (3, 8), (3, 7), (3, 6))

But what about Python 3.12.z and so on? Currently, the config file will need to be updated every time a new version of Python 3 becomes available. This may be by design (it may not be safe to assume that all future versions of Python 3 will work with the build scripts), but I would like to raise this question:

Would it be sufficient to check for any version of Python 3?

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