-
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
node-gyp rebuild is failing #2144
Comments
Please run the following commands:
|
python3 --version: |
Please try: |
Hi @cclauss
I also tried using python2 in place of python3, getting the following response:
FYI: I am trying to build vscode source code in my ubuntu machine. Even if the above method would have worked, I feel it still needs consideration, as we might trigger the build n number of times and we need to give the command every time. |
What is the command that you are running?? @ryzokuken @targos Does the Python 3 error relate to nodejs/gyp-next#3? |
I was using I also tried building that specific module using |
If you are using python2, you may need to link
|
Hi @gengjiawen , if you see 4 line of the output in the first comment, it says it found python. I also created an alias |
Hi, do we have any update here |
Do you get identical results if you use node-gyp v7.0.0 and Python 3? If yes, then please try Please provide the exact commands that you are typing on the command line. |
@cclauss we don't have |
Someone else (Chromium Authors) does. |
@cclauss right. I'm not sure it's worth talking to the Google OSPO in order to manage to get access to that, but I could kick off an email thread if you feel too strongly about it. |
Would it be possible to change node-gyp so that it doesn't fail when there are multiple python versions installed? Or at least that it gives a reasonable error message? I run into problems with this module every 6 months or so and it always is super frustrating and difficult to find a solution (or the problem, in the first place). And I never even used this module directly but it's a dependency for every other module out there. |
@Badestrand What is wrong with the suggestion at #2144 (comment) ? Please provide the command that you are typing and a complete error log if that suggestion is not providing you with access to the Python of your choice. |
Thank you @cclauss, that actually worked. What I am getting at is that I always find it difficult to find the correct solution. In the last few hours I had a variety of different error messages from node-gyp, by trying to install the pg-native module. The error messages were:
Googeling these errors took some hours and a lot of retries until I reached at this thread and discovered that I need to set NODE_GYP_FORCE_PYTHON. Inbetween there was something about upgrading node-gyp as well but couldn't find how to do it when it isn't even mentioned in the package-lock.json and not installed as global module. And as mentioned, I have errors like these from node-gyp every half year or so and on different projects. If the Python version issue is the source of a significant portion of build fails for people then it would be a huge help if this module could test for that and display a nice error message (instead of failing with one of the ones above) or even just set NODE_GYP_FORCE_PYTHON itself so it doesn't even fail. |
Difficult to understand because
This is Python 3 ensuring that the file mode and write contents are matching data type.
Python 2 died on 1/1/2020 so Node.js and node-gyp should drop support for legacy Python as discussed in #2093. |
|
@jabbar86 Your output above contains both |
@cclauss No luck I think Python is not an issue. here is a full log gyp info using node-gyp@7.1.0
gyp info using node@14.9.0 | win32 | x64
gyp info find Python using Python version 3.8.5 found at "C:\Python38\python.exe"
gyp info find VS using VS2019 (16.7.30523.141) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Python38\python.exe
gyp info spawn args [
gyp info spawn args 'C:\\Users\\jabba\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-I',
gyp info spawn args 'E:\\Zoop\\zoop-product-v0\\src\\node_modules\\node-expat\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\jabba\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\jabba\\AppData\\Local\\node-gyp\\Cache\\14.9.0\\include\\node\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\jabba\\AppData\\Local\\node-gyp\\Cache\\14.9.0',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\jabba\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\jabba\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\14.9.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args '-Dmodule_root_dir=E:\\Zoop\\zoop-product-v0\\src\\node_modules\\node-expat',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'E:\\Zoop\\zoop-product-v0\\src\\node_modules\\node-expat\\build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
Warning: Missing input files:
E:\Zoop\zoop-product-v0\src\node_modules\node-expat\build\deps\libexpat\..\..\..\deps\libexpat\version.c
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
E:\Zoop\zoop-product-v0\src\node_modules\node-expat\build\deps\libexpat\expat.vcxproj(21,3): error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\\Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\jabba\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:194:23)gyp ERR! stack at ChildProcess.emit (events.js:314:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\jabba\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\Zoop\zoop-product-v0\src\node_modules\node-expat |
It seems from the log that |
Hey @ryzokuken I have update the env variables now getting this error
|
This works for me :)
|
Yeah, the previous was an error in a specific version of |
P.S. can someone with triage access please close this? |
I'm sorry to re-open this, I've tried all the methods listed here, but none resolve my issue. system: Macbook with all the approaches listed here, I'm still obtaining this:
|
@steveoni You have a different problem than the others on this issue. Please read |
@cclauss thanks it works. I really appreciate your fast response. I was really frustrated. I tried different things. Thanks once again. |
@kosuruvarunkumar - did you figure out a solution? I am having the same issue with installing @vscode/sqlite3. I tried setting NODE_GYP_FORCE_PYTHON=python3 in my environment before running yarn install but no change... |
Run
The current macOS removes Python 2 so If Py2 is still on your machine, then perhaps it was installed by homebrew, macports, anaconda, pyenv, etc. |
@cclauss Thank you so much It worked for me. |
Node: v10.19.0
andNPM: 6.14.5
Ubuntu 20.04
vscode-sqlite3
Verbose output (from npm or node-gyp):
The text was updated successfully, but these errors were encountered: