Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
s100 opened this issue Mar 7, 2023 · 1 comment · Fixed by #140
Closed

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

s100 opened this issue Mar 7, 2023 · 1 comment · Fixed by #140

Comments

@s100
Copy link

s100 commented Mar 7, 2023

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  dependencies=tree-sitter@0.20.1 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 prebuild-install@6.1.4, which depends on node-abi@^2.21.0, which resolves to node-abi@2.30.1, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants