Skip to content

Not compatible with newer versions of Electron; prebuild-install needs updating #126

Closed

Description

@s100

This is Windows 11, 64-bit. Create a package.json like so:

{
  "name": "test",
  "version": "1.0.0",
  "description": "test",
  "author": "s100"
}

Then run:

npm install tree-sitter
npm install --save-dev electron electron-builder
npx electron-builder

I see this error:

  • electron-builder  version=23.6.0 os=10.0.22000
  • writing effective config  file=dist\builder-effective-config.yaml
  • rebuilding native dependencies  [email protected] platform=win32 arch=x64
  • install prebuilt binary  name=tree-sitter version=0.20.1 platform=win32 arch=x64 napi=
  • build native dependency from sources  name=tree-sitter
                                          version=0.20.1
                                          platform=win32
                                          arch=x64
                                          napi=
                                          reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information)
                                          error=C:\...\test\node_modules\node-abi\index.js:36
      throw new Error('Could not detect abi for version ' + target + ' and runtime ' + runtime + '.  Updating "node-abi" might help solve this issue if it is a new release of ' + runtime)
      ^

    Error: Could not detect abi for version 22.3.2 and runtime electron.  Updating "node-abi" might help solve this issue if it is a new release of electron
        at getAbi (C:\...\test\Downloads\a\node_modules\node-abi\index.js:36:9)
        at module.exports (C:\...\test\Downloads\a\node_modules\prebuild-install\rc.js:52:57)
        at Object.<anonymous> (C:\...\test\Downloads\a\node_modules\prebuild-install\bin.js:8:25)
        at Module._compile (node:internal/modules/cjs/loader:1105:14)
        at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
        at Module.load (node:internal/modules/cjs/loader:981:32)
        at Function.Module._load (node:internal/modules/cjs/loader:822:12)
        at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
        at node:internal/main/run_main_module:17:47

This is happening because tree-sitter depends on prebuild-install@^6.0.1, which resolves to [email protected], which depends on node-abi@^2.21.0, which resolves to [email protected], which is from August 2021 and only recognises versions of Electron up to 15.x.y. As seen above, we're up to Electron 22.3.2 right now.

This can be fixed by upgrading to prebuild-install@7, which uses node-abi@3, which recognises all the latest versions of Electron. Note however that prebuild-install@7 dropped support for Node.js < 10, which means tree-sitter would too. This may require a minor version bump on your part.

Activity

  1. logesh-jarvis commented on Jun 14, 2023

    @logesh-jarvis

    Any timeline when this will be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions