Repository navigation
Unable to build nodejs #30949
Copy link
Copy link
Closed
Labels
buildIssues and PRs related to Node.js builds or CI infrastructure.Issues and PRs related to Node.js builds or CI infrastructure.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
Description
- Version: master branch from the github repo
- Platform: windows
- Subsystem: build
Installed python 2.7 and python 3.6 and added both pythons to PATH and started vcbuild.bat, and got error:
Looking for Python
Python found in C:\Program Files\Python27\\python.exe
Looking for NASM
Looking for Visual Studio 2019
Looking for Visual Studio 2017
Found MSVS version 15.0
configure --dest-cpu=x64
Node.js configure: Found Python 2.7.0...
Traceback (most recent call last):
File "configure", line 26, in <module>
import configure
File "C:\nodejs\node\configure.py", line 1683, in <module>
configure_intl(output)
File "C:\nodejs\node\configure.py", line 1550, in configure_intl
with bz2.BZ2File(compressed_data, 'rb') as inf:
AttributeError: __exit__
Failed to create vc project files.
Now the questions are:
- Why does it fail?
- Why does it use python 2 instead of python 3 while documentation says "If both are installed Python 3 will be used. If only Python 2 is available it will be used instead."
- Why does it have two backslashes in
C:\Program Files\Python27\\python.exe?
Google search tells me that BZ2File does not support the context manager protocol. The following patch fixes the issue for me:
--- a/configure.py
+++ b/configure.py
@@ -1547,8 +1547,11 @@ def configure_intl(o):
os.mkdir(icu_tmp_path)
icu_data_path = os.path.join(icu_tmp_path, icu_data_file_l)
with open(icu_data_path, 'wb') as outf:
- with bz2.BZ2File(compressed_data, 'rb') as inf:
+ inf = bz2.BZ2File(compressed_data, 'rb')
+ try:
shutil.copyfileobj(inf, outf)
+ finally:
+ inf.close()
# Now, proceed..
# relative to dep..Should this fix be added to the master?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
buildIssues and PRs related to Node.js builds or CI infrastructure.Issues and PRs related to Node.js builds or CI infrastructure.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
Activity
pd4d10 commentedon Dec 14, 2019
It is probably because your python path has a trailing backslash. For compatible with no backslash case the full path would be something like
%PATH%\python.exe.I think this behavior could just be ignored if it does not cause other problems.
addaleax commentedon Dec 14, 2019
I think that seems fine to me, but I’d wonder why it’s not failing for anybody else?
lbh8srv68 commentedon Dec 15, 2019
Sure. Questions 1 and 2 are more important. BTW, my python path does not have trailing slash, even if I change to the path to the exe it still has 2 slashes. But if it is unrelated, we can ignore it I agree.
so should a pr be opened?
richardlau commentedon Jan 5, 2020
Probably https://bugs.python.org/issue24404 which says it was fixed from Python 2.7.1 onwards (the OP is using Python 2.7.0).
jasnell commentedon Jun 25, 2020
Unable to reproduce and there's been no further activity. Closing but we can reopen if necessary