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

Could not detect abi for version 6.0.0 and runtime electron #166

Closed
ottosson opened this issue Aug 5, 2019 · 6 comments
Closed

Could not detect abi for version 6.0.0 and runtime electron #166

ottosson opened this issue Aug 5, 2019 · 6 comments

Comments

@ottosson
Copy link
Contributor

ottosson commented Aug 5, 2019

Hi

I just updated my electron project from 5 to 6 and get the following error when running npm install:

> node postinstall

  • electron-builder  version=21.2.0
  • loaded configuration  file=C:\project\electron-builder.json
  • rebuilding native dependencies  [email protected] platform=win32 arch=x64
  • install prebuilt binary  name=registry-js version=1.8.0 platform=win32 arch=x64
  • build native dependency from sources  name=registry-js
                                          version=1.8.0
                                          platform=win32
                                          arch=x64
                                          reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information)
                                          error=C:\project\node_modules\node-abi\index.js:30
      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 6.0.0 and runtime electron.  Updating "node-abi" might help solve this issue if it is a new release of electron
...

I have removed my node_modules folder and updated to the latest version of registry-js (1.8.0) but still get the error. Not sure if I have missed something else... Any suggestion?

@shiftkey
Copy link
Member

shiftkey commented Aug 6, 2019

@ottosson thanks for the report! I'm not sure offhand because I thought #165 would address this, and it was included with 1.8.0 which you seem to be using.

Check you don't also have a node-abi dependency in your project that might be older than the current version. If you do ensure that you bump it to 2.10.0 which contains the Electron 6 update.

@ottosson
Copy link
Contributor Author

ottosson commented Aug 6, 2019

I don't have node-abi in my package.json

@ottosson
Copy link
Contributor Author

Ok so coming back to this issue again I tried to add node-abi (currently 2.11.0) as a dependency for my project and it works! I thought the node-abi would be added by another dependency, (maybe registry-js?), but it seems I was wrong. This fixes the issue for me.

Closing!

@shiftkey
Copy link
Member

@ottosson

I thought the node-abi would be added by another dependency, (maybe registry-js?), but it seems I was wrong.

It does exist as a dependency of prebuild-install - here's the version I got when installing into electron-quick-start:

$ npm ls node-abi
[email protected] /Users/shiftkey/src/electron-quick-start
└─┬ [email protected]
  └─┬ [email protected]
    └── [email protected]

But this dependency is a pretty relaxed version range:

    "node-abi": "^2.7.0",

What I believe was happening was that something else in your project had it's own node-abi dependency, and that older version was being used after upgrading to Electron 6 due to how npm de-dupes dependencies and the relaxed version constraint.

Anyway, overriding it by choosing the latest version in your project is the recommended option here - I'm glad you were able to find a workaround!

@ottosson
Copy link
Contributor Author

Ah, makes sense! Thanks for the explanation.

@yagoubigithub
Copy link

yagoubigithub commented Jun 12, 2024

update node-abi work for me
yarn upgrade node-abi
or
npm update node-abi

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

No branches or pull requests

3 participants