pnpm causes `node-gyp rebuild` failures

Created on 6 Nov 2019  Β·  1Comment  Β·  Source: pnpm/pnpm

pnpm version: 4.0.0, 4.0.2, 4.1.7

Last working version: 3.8.1

Code to reproduce the issue:

npm init -y
pnpm i better-sqlite3

Expected behavior:

better-sqlite3 is installed (as is the case with npm: npm i better-sqlite3 succeeds, which makes me think that the issue is with pnpm)

Actual behavior:

# pnpm i better-sqlite3
Packages: +11
+++++++++++
Resolving: total 11, reused 11, downloaded 0, done
node_modules/.pnpm/registry.npmjs.org/integer/2.1.0/node_modules/integer: Running install script, done in 2s
node_modules/.pnpm/registry.npmjs.org/better-sqlite3/5.4.3/node_modules/better-sqlite3: Running install script, failed in 393ms
.../5.4.3/node_modules/better-sqlite3 install$ node-gyp rebuild
β”‚ gyp info it worked if it ends with ok
β”‚ gyp info using [email protected]
β”‚ gyp info using [email protected] | linux | x64
β”‚ gyp info find Python using Python version 3.6.8 found at "/usr/bin/python3"
β”‚ gyp info spawn /usr/bin/python3
β”‚ gyp info spawn args [
β”‚ gyp info spawn args   '/usr/lib/node_modules/pnpm/lib/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   '/root/2/node_modules/.pnpm/registry.npmjs.org/better-sqlite3/5.4.3/node_modules/better-sqlite3/build/config.gypi',
β”‚ gyp info spawn args   '-I',
β”‚ gyp info spawn args   '/usr/lib/node_modules/pnpm/lib/node_modules/node-gyp/addon.gypi',
β”‚ gyp info spawn args   '-I',
β”‚ gyp info spawn args   '/root/.cache/node-gyp/12.13.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=/root/.cache/node-gyp/12.13.0',
β”‚ gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/pnpm/lib/node_modules/node-gyp',
β”‚ gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/12.13.0/<(target_arch)/node.lib',
β”‚ gyp info spawn args   '-Dmodule_root_dir=/root/2/node_modules/.pnpm/registry.npmjs.org/better-sqlite3/5.4.3/node_modules/better-sqlite3',
β”‚ 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 ]
β”‚ Traceback (most recent call last):
β”‚   File "/usr/lib/node_modules/pnpm/lib/node_modules/node-gyp/gyp/gyp_main.py", line 50, in <module>
β”‚     sys.exit(gyp.script_main())
β”‚   File "/usr/lib/node_modules/pnpm/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 554, in script_main
β”‚     return main(sys.argv[1:])
β”‚   File "/usr/lib/node_modules/pnpm/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 547, in main
β”‚     return gyp_main(args)
β”‚   File "/usr/lib/node_modules/pnpm/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 532, in gyp_main
β”‚     generator.GenerateOutput(flat_list, targets, data, params)
β”‚   File "/usr/lib/node_modules/pnpm/lib/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 2215, in GenerateOutput
β”‚     part_of_all=qualified_target in needed_targets)
β”‚   File "/usr/lib/node_modules/pnpm/lib/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 794, in Write
β”‚     extra_mac_bundle_resources, part_of_all)
β”‚   File "/usr/lib/node_modules/pnpm/lib/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 978, in WriteActions
β”‚     part_of_all=part_of_all, command=name)
β”‚   File "/usr/lib/node_modules/pnpm/lib/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1724, in WriteDoCmd
β”‚     force = True)
β”‚   File "/usr/lib/node_modules/pnpm/lib/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py", line 1779, in WriteMakeRule
β”‚     cmddigest = hashlib.sha1(command if command else self.target).hexdigest()
β”‚ TypeError: Unicode-objects must be encoded before hashing
β”‚ gyp ERR! configure error
β”‚ gyp ERR! stack Error: `gyp` failed with exit code: 1
β”‚ gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/pnpm/lib/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 4.15.0-33-generic
β”‚ gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/pnpm/lib/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
β”‚ gyp ERR! cwd /root/2/node_modules/.pnpm/registry.npmjs.org/better-sqlite3/5.4.3/node_modules/better-sqlite3
β”‚ gyp ERR! node -v v12.13.0
β”‚ gyp ERR! node-gyp -v v6.0.0
β”‚ gyp ERR! not ok
└─ Failed in 393ms
 ERROR  Command failed with exit code 1.

(tried this on a fresh install of pnpm - with all of its stores removed)

Additional information:

  • node -v prints: v12.13.0
  • Windows, OS X, or Linux?: Linux
bug

Most helpful comment

It is probably because pnpm switched to the latest version of node-gyp.

Maybe we can make it configurable

>All comments

It is probably because pnpm switched to the latest version of node-gyp.

Maybe we can make it configurable

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zkochan picture zkochan  Β·  33Comments

andreineculau picture andreineculau  Β·  31Comments

jiripospisil picture jiripospisil  Β·  39Comments

seoker picture seoker  Β·  31Comments

nickpape picture nickpape  Β·  31Comments