Bug 1811698

Summary: [abrt] npm: ExpandVariables(): input.py:914:ExpandVariables:TypeError: write() argument must be str, not bytes while trying to load binding.gyp
Product: [Fedora] Fedora Reporter: kb1000 <fedora>
Component: nodejsAssignee: NodeJS Packaging SIG <nodejs-sig>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 31CC: matthias.andree, mrunge, nodejs-sig, sgallagh, tchollingsworth, thrcka, zsvetlik
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/8a0a83d884e0789270c9bafb3d6228b7856c0546
Whiteboard: abrt_hash:cbc1581276d570d4309c9050d657bad4753e9343;VARIANT_ID=workstation;
Fixed In Version: nodejs-12.16.1-3.fc32 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 08:00:15 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace
none
File: cpuinfo
none
File: environ
none
File: mountinfo
none
File: namespaces
none
File: open_fds none

Description kb1000 2020-03-09 15:03:18 UTC
Version-Release number of selected component:
1:npm-6.13.4-1.12.16.1.1.fc31

Additional info:
reporter:       libreport-2.12.0
cgroup:         0::/user.slice/user-1000.slice/user/gnome-terminal-server.service
cmdline:        /usr/bin/python /usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py binding.gyp -f make -I /home/kb1000/MGit/js/node_modules/deasync/build/config.gypi -I /usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I /home/kb1000/.cache/node-gyp/12.16.1/include/node/common.gypi -Dlibrary=shared_library -Dvisibility=default -Dnode_root_dir=/home/kb1000/.cache/node-gyp/12.16.1 -Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp -Dnode_lib_file=/home/kb1000/.cache/node-gyp/12.16.1/<(target_arch)/node.lib -Dmodule_root_dir=/home/kb1000/MGit/js/node_modules/deasync -Dnode_engine=v8 --depth=. --no-parallel --generator-output build -Goutput_dir=.
crash_function: ExpandVariables
exception_type: TypeError
executable:     /usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py
interpreter:    python-unversioned-command-3.7.6-2.fc31.noarch
kernel:         5.5.6-201.fc31.x86_64
runlevel:       N 5
type:           Python3
uid:            1000

Truncated backtrace:
#1 [/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py:914] ExpandVariables
#2 [/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py:1315] ProcessVariablesAndConditionsInList
#3 [/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py:1296] ProcessVariablesAndConditionsInDict
#4 [/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py:1311] ProcessVariablesAndConditionsInList
#5 [/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py:1296] ProcessVariablesAndConditionsInDict
#6 [/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py:417] LoadTargetBuildFile
#7 [/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py:2779] Load
#8 [/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py:139] Load
#9 [/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py:523] gyp_main
#10 [/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py:547] main

Comment 1 kb1000 2020-03-09 15:03:22 UTC
Created attachment 1668674 [details]
File: backtrace

Comment 2 kb1000 2020-03-09 15:03:23 UTC
Created attachment 1668675 [details]
File: cpuinfo

Comment 3 kb1000 2020-03-09 15:03:25 UTC
Created attachment 1668676 [details]
File: environ

Comment 4 kb1000 2020-03-09 15:03:27 UTC
Created attachment 1668677 [details]
File: mountinfo

Comment 5 kb1000 2020-03-09 15:03:28 UTC
Created attachment 1668678 [details]
File: namespaces

Comment 6 kb1000 2020-03-09 15:03:30 UTC
Created attachment 1668679 [details]
File: open_fds

Comment 7 Stephen Gallagher 2020-03-11 00:55:45 UTC
Can you please provide some additional details around what you were attempting to do here? It appears that you were trying to build npm itself and hit a bug with its support for Python 3 to build.

Comment 8 Stephen Gallagher 2020-03-16 12:20:09 UTC
*** Bug 1813652 has been marked as a duplicate of this bug. ***

Comment 9 Stephen Gallagher 2020-03-16 12:22:21 UTC
OK, I'm making a bit of a guess here, but I think what's happening is that node-gyp is incorrectly assuming that if python is invoked from /usr/bin/python, it must be python 2 (but on F31+ it's actually python 3). I'm adding a patch to /etc/npmrc that will set the default python interpreter explicitly to /usr/bin/python3 to hopefully work around this.

Comment 10 kb1000 2020-03-16 16:57:31 UTC
I'm sorry for not responding earlier, but I didn't try to build npm itself, but try to install node-sass 4.13.1 using yarn from https://classic.yarnpkg.com/en/docs/install/#centos-stable .
It pulled in deasync 0.1.19, this happened during the build of that package. Would yarn be fixed too by that patch?

Comment 11 Fedora Update System 2020-03-19 02:26:19 UTC
nodejs-12.16.1-3.fc32 has been pushed to the Fedora 32 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-7a79b4da6a

Comment 12 Fedora Update System 2020-03-27 08:00:15 UTC
FEDORA-2020-7a79b4da6a has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.