JS Electron fails to run

I have a project that suddenly stopped to build on Windows with Electron. I mean I have a matrix that runs same build on linux/macos/windows with nodejs/electron, and pair windows + electron started to fail recently.

My initial thought was that I broke it somehow, though I didn’t touch anything related to the build script or electron. After couple of days trying to fix it I found out that electron fails regardless if it runs with our code or not. I.e., it fails with the same error even after electron --version.

The error is:

$ ./node_modules/.bin/electron --version
C:/ProgramData/nvs/node/12.16.1/x64/node.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

It supposed to show output like

$ ./node_modules/.bin/electron --version
v7.1.5

Maybe something has changed on Travis side that causes Electron failure?

1 Like

I have simplified version to demonstrate the issue:

- yarn global add electron@7.1.14
- electron --version

Output:

The command "electron --version" exited with 127.
C:/ProgramData/nvs/node/12.16.1/x64/node.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

There is a demo project: https://travis-ci.org/splix/travis-electron-issue

The .travis.yml is just:

os:
  - osx
  - linux
  - windows

language: node_js

env:
  global:
      # needed for linux, removing it doesn't fix windows issue
    - ELECTRON_RUN_AS_NODE=true

node_js:
  - 12

script:
  - npm install -g electron@7.1.14
  - electron --version

Fails with:

$ electron --version

The command "electron --version" exited with 127.

Done. Your build exited with 1.

C:/ProgramData/nvs/node/12.16.1/x64/node.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

Do you have a build log URL to a passing Windows job? If you restart it and it fails now, the most likely explanation is that some underlying dependency changed and broke the build.

That’s interesting. I restarted an old build and it succeeded. Though any new build, even the empty project created to demonstrate the issue are always failing.

But it’s still doesn’t solve the problem, because I’m still unable to run even a simple projects (like in the demo) that uses Electron. Would appreciate any suggestions hot to make it working

After some debugging I found out that the original error is

error while loading shared libraries: dxva2.dll: cannot open shared object file: No such file or directory

Electron, which is based on Chromium, expects to find DirectX Video Acceleration library. Though I run it only as a testing environment, i.e., console only, Electron is still linked to that dll. I tried to install DirectX (choco install directx) but it doesn’t work on Travis, and I don’t have any idea how to get that library installed.

1 Like