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 22.3.3 and runtime electron. Updating "node-abi" might help solve this issue if it is a new release of electron at getAbi #1073

Closed
oalfroukh opened this issue Mar 23, 2023 · 8 comments

Comments

@oalfroukh
Copy link

oalfroukh commented Mar 23, 2023

Hi,

I'm using electron-builder v24.0.0 which uses electron-rebuild to rebuild the native dependencies (electron-userland/electron-builder#7196)

The generated app worked fine as I see (there are no exception errors in the main process when running the generated app).

  • While the issue is when building the app using Jenkins to publish the official version of our app, Jenkins job will fail due to the coming errors from electron-rebuild because our Jenkinsfile script contains try catch statement for technical needs to be able to build parallel Multiplatform for both Windows (32 and 64 bit) and macOS and signing the app with our certificate, for example, I'm using these dependencies:
 "dependencies": {
    "keytar": "7.9.0",
    "native-reg": "1.1.1",
    "node-hid": "2.1.2",
    "robotjs": "0.6.0",
    "sqlite3": "5.1.6"
  },

image

  • Here are the errors we have when rebuilding robotjs:
2023-03-23T10:39:59.340Z electron-rebuild assuming is prebuild-install powered: robotjs
2023-03-23T10:39:59.340Z electron-rebuild triggering prebuild download step: robotjs
2023-03-23T10:39:59.445Z electron-rebuild failed to use prebuild-install: ExitCodeError: Command failed with a non-zero return code (1):
C:\tools\nodejs\node-v16.15.1-win-x86\node.exe C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\@electron\rebuild\lib\src\prebuild-shim.js C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\robotjs\node_modules\prebuild-install\bin.js --arch=ia32 --platform=win32 --tag-prefix=totally-not-a-real-prefix-to-force-rebuild --runtime=electron --target=22.3.3

C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\robotjs\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.3 and runtime electron.  Updating "node-abi" might help solve this issue if it is a new release of electron
    at getAbi (C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\robotjs\node_modules\node-abi\index.js:36:9)
    at module.exports (C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\robotjs\node_modules\prebuild-install\rc.js:73:57)
    at Object.<anonymous> (C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\robotjs\node_modules\prebuild-install\bin.js:9: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 Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\@electron\rebuild\lib\src\prebuild-shim.js:5:1)
    at ChildProcess.<anonymous> (C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\@malept\cross-spawn-promise\src\index.ts:174:16)
    at ChildProcess.emit (node:events:527:28)
    at ChildProcess.cp.emit (C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
  cmd: 'C:\\tools\\nodejs\\node-v16.15.1-win-x86\\node.exe',
  args: [
    'C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\electron-quick-start\\node_modules\\@electron\\rebuild\\lib\\src\\prebuild-shim.js',
    'C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\electron-quick-start\\node_modules\\robotjs\\node_modules\\prebuild-install\\bin.js',
    '--arch=ia32',
    '--platform=win32',
    '--tag-prefix=totally-not-a-real-prefix-to-force-rebuild',
    '--runtime=electron',
    '--target=22.3.3'
  ],
  stdout: '',
  stderr: 'C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\electron-quick-start\\node_modules\\robotjs\\node_modules\\node-abi\\index.js:36\r\n' +
    `  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)\r\n` +
    '  ^\r\n' +
    '\r\n' +
    'Error: Could not detect abi for version 22.3.3 and runtime electron.  Updating "node-abi" might help solve this issue if it is a new release of electron\r\n' +
    '    at getAbi (C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\electron-quick-start\\node_modules\\robotjs\\node_modules\\node-abi\\index.js:36:9)\r\n' +
    '    at module.exports (C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\electron-quick-start\\node_modules\\robotjs\\node_modules\\prebuild-install\\rc.js:73:57)\r\n' +
    '    at Object.<anonymous> (C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\electron-quick-start\\node_modules\\robotjs\\node_modules\\prebuild-install\\bin.js:9:25)\r\n' +
    '    at Module._compile (node:internal/modules/cjs/loader:1105:14)\r\n' +
    '    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)\r\n' +
    '    at Module.load (node:internal/modules/cjs/loader:981:32)\r\n' +
    '    at Function.Module._load (node:internal/modules/cjs/loader:822:12)\r\n' +
    '    at Module.require (node:internal/modules/cjs/loader:1005:19)\r\n' +
    '    at require (node:internal/modules/cjs/helpers:102:18)\r\n' +
    '    at Object.<anonymous> (C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\electron-quick-start\\node_modules\\@electron\\rebuild\\lib\\src\\prebuild-shim.js:5:1)\r\n',
  code: 1
}
2023-03-23T10:39:59.447Z electron-rebuild rebuilding robotjs with args [
  'node',
  'node-gyp',
  'rebuild',
  '--runtime=electron',
  '--target=22.3.3',
  '--arch=ia32',
  '--dist-url=https://www.electronjs.org/headers',
  '--build-from-source',
  '--verbose'
]
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb download using dist-url https://www.electronjs.org/headers
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python checking Python explicitly set from environment variable PYTHON
gyp verb find Python - process.env.PYTHON is "C:\Users\oalfroukh\AppData\Local\Programs\Python\Python39\python.exe"
gyp verb find Python - executing "C:\Users\oalfroukh\AppData\Local\Programs\Python\Python39\python.exe" to get executable path
gyp verb find Python - executable path is "C:\Users\oalfroukh\AppData\Local\Programs\Python\Python39\python.exe"
gyp verb find Python - executing "C:\Users\oalfroukh\AppData\Local\Programs\Python\Python39\python.exe" to get version
gyp verb find Python - version is "3.9.13"
gyp info find Python using Python version 3.9.13 found at "C:\Users\oalfroukh\AppData\Local\Programs\Python\Python39\python.exe"
gyp verb get node dir compiling against --target node version: 22.3.3
gyp verb command install [ '22.3.3' ]
gyp verb download using dist-url https://www.electronjs.org/headers
gyp verb install input version string "22.3.3"
gyp verb install installing version: 22.3.3
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 22.3.3
gyp verb build dir attempting to create "build" dir: C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\robotjs\build
gyp verb build dir "build" dir needed to be created? Yes
gyp verb find VS msvs_version not set from command line or npm config
gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp verb find VS checking VS2019 (16.11.31613.86) found at:
gyp verb find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp verb find VS - found "Visual Studio C++ core features"
gyp verb find VS - found VC++ toolset: v142
gyp verb find VS - found Windows SDK: 10.0.19041.0
gyp info find VS using VS2019 (16.11.31613.86) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp info find VS run with --verbose for detailed information
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\robotjs\build\config.gypi
gyp verb config.gypi checking for gypi file: C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\robotjs\config.gypi
gyp verb common.gypi checking for gypi file: C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\robotjs\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn C:\Users\oalfroukh\AppData\Local\Programs\Python\Python39\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\electron-quick-start\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\electron-quick-start\\node_modules\\robotjs\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\electron-quick-start\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Windows\\system32\\config\\systemprofile\\.electron-gyp\\22.3.3\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Windows\\system32\\config\\systemprofile\\.electron-gyp\\22.3.3',
gyp info spawn args   '-Dnode_gyp_dir=C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\electron-quick-start\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Windows\\\\system32\\\\config\\\\systemprofile\\\\.electron-gyp\\\\22.3.3\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\electron-quick-start\\node_modules\\robotjs',
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   'C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\electron-quick-start\\node_modules\\robotjs\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp verb command build [ map: [Function (anonymous)] ]
gyp verb build type Release
gyp verb architecture ia32
gyp verb node dev dir C:\Windows\system32\config\systemprofile\.electron-gyp\22.3.3
gyp verb found first Solution file build/binding.sln
gyp verb using MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args   'build/binding.sln',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=Win32',
gyp info spawn args   map: [Function (anonymous)]
gyp info spawn args ]
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
Build started 3/23/2023 12:40:01 PM.
Project "C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\robotjs\build\binding.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Release|Win32".
Project "C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\robotjs\build\binding.sln" (1) is building "C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\robotjs\build\robotjs.vcxproj" (2) on node 1 (default targets).
PrepareForBuild:
  Creating directory "Release\obj\robotjs\".
  Creating directory "Release\obj\robotjs\robotjs.tlog\".
InitializeBuildStatus:
  Creating "Release\obj\robotjs\robotjs.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
MakeDirsForCl:
  • Also here are the errors we have when rebuilding keytar as well as node-hid:
2023-03-23T10:39:39.786Z electron-rebuild assuming is prebuild-install powered: keytar
2023-03-23T10:39:39.787Z electron-rebuild triggering prebuild download step: keytar
2023-03-23T10:39:40.573Z electron-rebuild failed to use prebuild-install: ExitCodeError: Command failed with a non-zero return code (1):
C:\tools\nodejs\node-v16.15.1-win-x86\node.exe C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\@electron\rebuild\lib\src\prebuild-shim.js C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\prebuild-install\bin.js --arch=ia32 --platform=win32 --tag-prefix=totally-not-a-real-prefix-to-force-rebuild --runtime=napi --target=3

prebuild-install warn install No prebuilt binaries found (target=3 runtime=napi arch=ia32 libc= platform=win32)
    at ChildProcess.<anonymous> (C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\@malept\cross-spawn-promise\src\index.ts:174:16)
    at ChildProcess.emit (node:events:527:28)
    at ChildProcess.cp.emit (C:\ProgramData\Jenkins\.jenkins\workspace\electron-quick-start\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
  cmd: 'C:\\tools\\nodejs\\node-v16.15.1-win-x86\\node.exe',
  args: [
    'C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\electron-quick-start\\node_modules\\@electron\\rebuild\\lib\\src\\prebuild-shim.js',
    'C:\\ProgramData\\Jenkins\\.jenkins\\workspace\\electron-quick-start\\node_modules\\prebuild-install\\bin.js',
    '--arch=ia32',
    '--platform=win32',
    '--tag-prefix=totally-not-a-real-prefix-to-force-rebuild',
    '--runtime=napi',
    '--target=3'
  ],
  stdout: '',
  stderr: 'prebuild-install warn install No prebuilt binaries found (target=3 runtime=napi arch=ia32 libc= platform=win32)\n',
  code: 1
}
2023-03-23T10:39:40.603Z electron-rebuild rebuilding keytar with args [
  'node',
  'node-gyp',
  'rebuild',
  '--runtime=electron',
  '--target=22.3.3',
  '--arch=ia32',
  '--dist-url=https://www.electronjs.org/headers',
  '--build-from-source',
  '--verbose'
]

Thanks in advance!

@oalfroukh
Copy link
Author

Hi @MarshallOfSound
I'm not sure if I created this issue in the right repo, maybe it's related to https://github.com/electron/node-abi

Any suggestions are welcome!

@yudax42
Copy link

yudax42 commented Mar 26, 2023

Same issue

Screenshot 2023-03-26 at 04 14 01

@oalfroukh
Copy link
Author

Same issue

Screenshot 2023-03-26 at 04 14 01

Are you sure you are using the latest electron-builder version that is using electron-rebuild for rebuilding the native dependencies (v24.0.0)?

@yudax42
Copy link

yudax42 commented Mar 26, 2023

Thanks @oalfroukh It looks like it's working now that I've updated it to the latest pre-release!

Screenshot 2023-03-26 at 10 51 40

@MarshallOfSound MarshallOfSound closed this as not planned Won't fix, can't repro, duplicate, stale Apr 13, 2023
@castroCrea
Copy link

castroCrea commented Dec 11, 2023

Hey this is still happening, when you update on lastest release of the electron, even with electron-rebuild on the last version.
Do there is an automatic flow where we can contribute to fixing it ? @MarshallOfSound

image image
Could not detect abi for version 28.0.0 and runtime electron.  Updating "node-abi" might help solve this issue if it is a new release of electron

Error: Could not detect abi for version 28.0.0 and runtime electron.  Updating "node-abi" might help solve this issue if it is a new release of electron
    at Object.getAbi (/Users/distiller/project/node_modules/@electron/rebuild/node_modules/node-abi/index.js:39:9)
    at Rebuilder.get ABI [as ABI] (/Users/distiller/project/node_modules/@electron/rebuild/lib/rebuild.js:89:39)
    at PrebuildInstall.prebuiltModuleExists (/Users/distiller/project/node_modules/@electron/rebuild/lib/module-type/prebuild-install.js:59:179)
    at ModuleRebuilder.prebuildInstallNativeModuleExists (/Users/distiller/project/node_modules/@electron/rebuild/lib/module-rebuilder.js:70:37)
    at Rebuilder.rebuildModuleAt (/Users/distiller/project/node_modules/@electron/rebuild/lib/rebuild.js:143:35)
    at async Rebuilder.rebuild (/Users/distiller/project/node_modules/@electron/rebuild/lib/rebuild.js:115:17)
    at async /Users/distiller/project/node_modules/@electron/rebuild/lib/cli.js:159:9

@bbb169
Copy link

bbb169 commented Jan 25, 2024

is there any way to solve this?

@oalfroukh
Copy link
Author

is there any way to solve this?

You can use overrides on the package.json, for example:

 "overrides": {
   "node-abi": "3.51.0"
  }

@bbb169
Copy link

bbb169 commented Jan 25, 2024

is there any way to solve this?

You can use overrides on the package.json, for example:

 "overrides": {
   "node-abi": "3.51.0"
  }

thank you very much, but this didn't solve my problem, but I found another way to solve this
I found a fork of robotjs, and I use this library to replace robotjs, https://github.com/hurdlegroup/robotjs

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

5 participants