-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Still need Python2 to run node-gyp v5.0.3 #1977
Comments
C:\Users\81810\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js is node-gyp@6.0.1 |
@HanqingTony please update npm:
|
Hi there, I had a similar issue. I upgraded to OSX Catalina. Then when doing node-gyp build I got the error as in below. I realised Catalina does not take the old 32 bit python previously installed, so I installed Python3. However, even after changing the alias for python, verifying PATH and even enforcing node-gyp build --python=(python3path), it seemed as if node-gyp was still looking for python v2. The solution was to reinstall python2 for 64 bits. % node-gyp build |
I have the same issue |
Please look at this article from 2019: https://spin.atomicobject.com/2019/03/27/node-gyp-windows/ On Windows, you have to use Python 2.7 and Microsoft Visual Studio 2015:
Latest version December 6, 2019; Python 3.8 (October 14th, 2019), Visual Studio 2019 (April 2, 2019)............ |
please stop reading old articles and assuming they indicate the current state of a piece of software, the date is even in the URL and it's 9 months old. see the node-gyp README for current state and if you have an old version, update it and try again, same with npm which can be updated with |
9 months ago is an old article in your opinion? Of course I followed the node-gyp README. Which did not fix my environment. Here is a more recent discussion (with a solution that worked for me); https://stackoverflow.com/a/57763427/4234891 |
You do not need Python 2.7 in order to run node-gyp. Python 3 has been supported since version 5.0.5. If you have verified that your issue is python related, as in that node-gyp is trying to run a script which contains errors according to the python 3 interpreter, then try the following:
Both modules are separate, npm will have its own copy of node-gyp. If you are trying to link a local package, for instance, npm will use its own copy of node-gyp. However, if you run node-gyp from the command line, it will use the other. Of course, all of this is irrelevant if you don't have a valid installation setup. You will need build tools, as the previously linked articles mention. Windows voodoo dictates that you will probably have to mess around in order to get everything setup on the runtime side. However, you do not need python 2.7. |
Previously I had started an Issue to suggested node-gyp should turn to python3. Couple of weeks ago, one of the contributor of node-gyp replied to me, saying that node-gyp now support pure python3. So I think there was no doubt that articles about python2 would be out of date |
I ran into this on Win10. It was a pretty crummy experience. The Node v13 installer tried to install some node-gyp dependencies + Chocolatey, opened a command prompt which flashed an error message, then the window flashed away with no further error. When I tried to py -2 %* BUT, because the Node installer failed to install all those dependencies for node-gyp, I also had to install VS build tool 2015 (v140) and 2017 (v141) and launch |
You are using a version of node or node-gyp that does not support Python 3. This was fixed a long time ago. |
Looks like https://github.com/sass/node-sass/blob/c6f2e5a1643dd00105b63a638756dc99fc33c3e4/package.json#L67 |
@cclauss You're right, it's an issue with a dependency and different than the one in the bug report. It's unfortunate that these errors appear as node-gyp errors. Thanks for the correction and thanks @richardlau for pointing out the potential issue with node-gyp. I'll file a bug report there. |
End of Life of Python 2 is TODAY. Can this issue be closed? |
I'm happy for you to make that call @cclauss, and on most things Python. |
If you consult node-gyp README here Option 1 directs you to the windows-build-tools page which says "If not already installed, it will also install Python 2.7, configuring your machine and npm appropriately." Is it possible to avoid Python 2 or not? |
Please follow option 2 to use Python 3. |
Under Option 2 it says "If the above steps didn't work for you, please visit Microsoft's Node.js Guidelines for Windows additional tips." At that link it says under Prerequisites "Install Python 2.7 (v3.x.x is not supported), and run npm config set python python2.7" I don't want to install Python 2 as I have Python 3 and I don't want to mess that up. I am trying to install Node.js so that I can run ESlint and Prettier in Visual Studio Code. |
Which of the steps above don’t work for you? |
Admittedly I have not yet tried the steps in Option 2 because I am still doing some research and don't want to mess things up. Am I correct in thinking that if I am to get this to work, I need either Visual Studio Build Tools or Visual Studio 2017 Community? I am in a team of 8 and so if we all tried to use this set up we would require an enterprise license for either as discussed here and here. That license would be around $250 a month. Visual Studio Code, Python or Node.js do not require such a license themselves so this seems a bit odd. Can I get away with not installing the additional bits for node to compile npm modules from C/C++? How can I find which modules require this? |
Fixed via nodejs/node#31221. |
To answer my own question, I installed Node using the setup wizard and then got ESLint and Prettier to work in Visual Studio Code without installing the support for native modules (i.e. Python 2, Visual Studio Build Tools or Visual Studio). Thanks |
Closing. Python 3 is now supported in both node-gyp v5 and v6 |
Is node-gys still required only python 2.7 ? |
This issue is closed. https://github.com/nodejs/node-gyp#on-unix Python 2 died on 1/1/2020. |
I just tried to npm i on a project that was Angular 8, moving to 9. Could not continue until I added windows-build-tools, which installed Python 2. |
C:\Users\Wakilie\Downloads\Boy>npm install
node-pre-gyp WARN Using request for node-pre-gyp https download npm ERR! code ELIFECYCLE npm ERR! A complete log of this run can be found in: C:\Users\Wakilie\Downloads\Boy>npm install -g npm
C:\Users\Wakilie\Downloads\Boy>npm install
node-pre-gyp WARN Using request for node-pre-gyp https download npm ERR! code ELIFECYCLE npm ERR! A complete log of this run can be found in: |
@Zunnurayni Please install Python from the Microsoft store and then try again. |
If it's an option for you, backup your package-lock.json, remove it, and then try an install again. |
good day, i have similar issue and have tried removing the "package-lock.json" file but it still didn't work... please do you have any other suggestions? thanks |
HAD SIMILAR ISSUES BUT GOT THE SOLUTION:
|
Current release is v7.0.0 |
This bug still lingers in 2021 -- because old versions of node-gyp linger. On my system, these steps resolved the problem (don't know which one was needed) From administrator prompt on Windows:
All of these were run from the project folder containing the yarn configuration file and from the same adminstrative prompt. But then yarn fails. |
Still need python2, i don't know why. i installed node-gyp with python 3.73
The text was updated successfully, but these errors were encountered: