Node-gyp: write() argument must be str, not bytes while trying to load binding.gyp

Created on 20 Feb 2020  Â·  2Comments  Â·  Source: nodejs/node-gyp

  • Node Version: Node.js 12.14.1 and npm 6.13.4
  • Platform: Linux localhost 3.18.137-g72a7a64494e #​1 SMP PREEMPT Fri Sep 27 18:40:34 UTC 2019 aarch64 Android
  • Compiler:
    clang version 9.0.1
    Target: aarch64-unknown-linux-android
    Thread model: posix
    InstalledDir: /data/data/com.termux/files/usr/bin
  • Module: sodium-native

Verbose output (from npm or node-gyp):

Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 50, in <module>
    sys.exit(gyp.script_main())
  File "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 554, in script_main
    return main(sys.argv[1:])
  File "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 547, in main
    return gyp_main(args)
  File "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 520, in gyp_main
    [generator, flat_list, targets, data] = Load(
  File "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 136, in Load
    result = gyp.input.Load(build_files, default_variables, includes[:],
  File "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2778, in Load
    LoadTargetBuildFile(build_file, data, aux_data,
  File "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 416, in LoadTargetBuildFile
    ProcessVariablesAndConditionsInDict(
  File "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 1295, in ProcessVariablesAndConditionsInDict
    ProcessVariablesAndConditionsInList(value, phase, variables,
  File "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 1311, in ProcessVariablesAndConditionsInList
    ProcessVariablesAndConditionsInDict(item, phase, variables, build_file)
  File "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 1295, in ProcessVariablesAndConditionsInDict
    ProcessVariablesAndConditionsInList(value, phase, variables,
  File "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 1315, in ProcessVariablesAndConditionsInList
    expanded = ExpandVariables(item, phase, variables, build_file)
  File "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 914, in ExpandVariables
    sys.stderr.write(p_stderr)
TypeError: write() argument must be str, not bytes while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack

TypeError: write() argument must be str, not bytes while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 3.18.137-g72a7a64494e
gyp ERR! command "/data/data/com.termux/files/usr/bin/node" "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /data/data/com.termux/files/home/oasis/node_modules/sodium-native
gyp ERR! node -v v13.0.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok

Most helpful comment

Thank you! npm -g install npm did the trick.

All 2 comments

Thank you! npm -g install npm did the trick.

Was this page helpful?
0 / 5 - 0 ratings