kriszyp / lmdb-js

Simple, efficient, ultra-fast, scalable data store wrapper for LMDB
Other
520 stars 44 forks source link

@emotion/css won't install due to lmdb-js relying on outdated node-gyp-build #307

Closed stil closed 2 months ago

stil commented 2 months ago

I'm trying to install packages (yarn command) in @emotion/css repository.

Error I get:

➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 0s 522ms
➤ YN0000: ┌ Link step
➤ YN0007: │ lmdb-store@npm:1.6.13 must be built because it never has been before or the last one failed
➤ YN0009: │ lmdb-store@npm:1.6.13 couldn't be built successfully (exit code 1, logs can be found here: C:\Users\...\AppData\Local\Temp\xfs-65ed545b\build.log)
➤ YN0000: └ Completed in 1s 156ms
➤ YN0000: Failed with errors in 2s 3ms

Contents of build.log

# This file contains the result of Yarn building a package (lmdb-store@npm:1.6.13)
# Script name: install

{ args: [ 'node-gyp.cmd', 'rebuild' ] }
node:internal/child_process:421
    throw new ErrnoException(err, 'spawn');
    ^

Error: spawn EINVAL
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at Object.spawn (node:child_process:761:9)
    at build (Z:\git\thirdparty\emotion\node_modules\node-gyp-build\bin.js:30:8)
    at preinstall (Z:\git\thirdparty\emotion\node_modules\node-gyp-build\bin.js:39:32)
    at Z:\git\thirdparty\emotion\node_modules\node-gyp-build\bin.js:11:7
    at ChildProcess.exithandler (node:child_process:430:5)
    at ChildProcess.emit (node:events:519:28)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:519:28) {
  errno: -4071,
  code: 'EINVAL',
  syscall: 'spawn'
}

Node.js v20.15.0

The problem is tracked in https://github.com/prebuild/node-gyp-build/issues/68 and has already been fixed in node-gyp-build 4.8.1.

This library uses node-gyp-build-optional-packages but where does it come from? npmjs.com points to @kriszyp as a package maintainer but I couldn't find the repo.

Can I ask you to upgrade node-gyp-build-optional-packages (I assume this is a fork) to the latest upstream version of node-gyp-build?

Thank you.

stil commented 2 months ago

Actually it's due to @emotion/css indirectly relying on @parcel/cache: ^2.0.1 which uses old lmdb-store: ^1.5.5 that back then was using the regular node-gyp-build instead of node-gyp-build-optional-packages.

I tried add to package.json the following resolution:

  "resolutions": {
    "node-gyp-build": "^4.8.2"
  }

The gyp problem was eliminated, but it failed with native code compilation errors.

I think it's because lmdb-store: ^1.5.5 was published before NodeJS 20 APIs? And rolling back to older NodeJS should fix the problem.

stil commented 2 months ago

Bumped parcel dependency in emotion-js/emotion from ^2.0.1 to ^2.12.1 and it fixed the problem. Case closed, will fill an issue in emotion-js/emotion repo.