nodejs / node-gyp

Node.js native addon build tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[DOCS] The latest version of python (3.12) doesn't support node-gyp #7161

harshajk opened this issue · comments

Is there an existing issue for this?
I have searched the existing issues
This is a CLI Docs Problem, not another kind of Docs Problem.
This is a CLI Docs Problem.
Description of Problem
I am trying the below

npm install

However, I see the below error

npm ERR! ModuleNotFoundError: No module named 'distutils

Reason: The latest version of python (3.12) doesn't support node-gyp.

Potential Solution
node-gyp is currenlty supported only up to python version 3.11

Affected URL
https://www.npmjs.com/package/node-gyp#on-windows

Going through the comments, does running the below command help fix the distutils error?

Link for the comment - #2869 (comment)

python3 -m pip install packaging

Let's vendor in packaging so that installing node-gyp does not require running pip install packaging.

We just include all the packaging files in the node-gyp release to avoid the support questions from Node.js users running pip.

I added a clarification at the top of #2869 (comment)