Skip to content

NPM install fails with node-gyp error: cannot use a string pattern on a bytes-like object #155

@cakoose

Description

@cakoose
  • macOS 10.15.3, Node 12.14.1
  • I tested with a package.json that lists just a single dependency, "sodium" at version "3.0.2".
  • I tried with both yarn install and npm install
  • I tried both Python 2.7.17 and 3.7.6. (I used the environment variable NODE_GYP_FORCE_PYTHON, which I think worked because the output says "gyp info find Python using Python version ..." and the version matches what I set.)

Full yarn install output:

yarn install v1.21.1
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
error /Users/kannan/temp/node_modules/sodium: Command failed.
Exit code: 1
Command: node install.js --install
Arguments: 
Directory: /Users/kannan/temp/node_modules/sodium
Output:
echo Build node-sodium module
Build node-sodium module
node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@5.0.5
gyp info using node@12.14.1 | darwin | x64
gyp info find Python using Python version 2.7.17 found at "/Users/kannan/.pyenv/versions/2.7.17/bin/python2.7"
gyp info spawn /Users/kannan/.pyenv/versions/2.7.17/bin/python2.7
gyp info spawn args [
gyp info spawn args   '/Users/kannan/.nodenv/versions/12.14.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kannan/temp/node_modules/sodium/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kannan/.nodenv/versions/12.14.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/kannan/Library/Caches/node-gyp/12.14.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/kannan/Library/Caches/node-gyp/12.14.1',
gyp info spawn args   '-Dnode_gyp_dir=/Users/kannan/.nodenv/versions/12.14.1/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/kannan/Library/Caches/node-gyp/12.14.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/kannan/temp/node_modules/sodium',
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   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
  LIBTOOL-STATIC Release/nothing.a
Traceback (most recent call last):
  File "./gyp-mac-tool", line 611, in <module>
    sys.exit(main(sys.argv[1:]))
  File "./gyp-mac-tool", line 30, in main
    exit_code = executor.Dispatch(args)
  File "./gyp-mac-tool", line 45, in Dispatch
    return getattr(self, method)(*args[1:])
  File "./gyp-mac-tool", line 248, in ExecFilterLibtool
    if not libtool_re.match(line) and not libtool_re5.match(line):
TypeError: cannot use a string pattern on a bytes-like object
make[1]: *** [Release/nothing.a] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/kannan/.nodenv/versions/12.14.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:223:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/Users/kannan/.nodenv/versions/12.14.1/bin/node" "/Users/kannan/.nodenv/versions/12.14.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/kannan/temp/node_modules/sodium
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
make: *** [nodesodium] Error 1
/Users/kannan/temp/node_modules/sodium/install.js:293
            throw new Error(cmdLine + ' exited with code ' + code);
            ^

Error: make nodesodium exited with code 2
    at ChildProcess.<anonymous> (/Users/kannan/temp/node_modules/sodium/install.js:293:19)
    at ChildProcess.emit (events.js:223:5)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions