Skip to content

[Node.js] Brainflow not working in electron when electron-app is packaged (node.js) #733

@GordonPmnt

Description

@GordonPmnt

Describe the bug

This is more a compatibility issue with the Node.js package and electron.js.

When running brainflow in an electron app, it\s working well in a dev env. But when packaging the app, electron cannot resolve the dll path in Boardshim constructor.

this.libPath = `${__dirname}/../brainflow/lib`;

Today, in order to solve this issue, we had to adapt brainflow a bit:

    const RESOURCES_PATH = app.isPackaged
      ? path.join(process.resourcesPath, 'app.asar.unpacked', 'node_modules', 'brainflow')
      : path.join(__dirname, '../../brainflow');
    this.libPath = path.join(RESOURCES_PATH, 'brainflow', 'lib');

To Reproduce

Install brainflow in an electron app. Create a button running an instance of synthetic board.

Run it locally, it will work.

Then, package the app and run it. Electron shoudl complain because it cannot resolve path to import dll files.

Info (please complete the following information):

  • Board Id: any
  • OS running on your PC: any
  • Programming Language and its version: node.js 20
  • Architecture(x86, x64, ARM, etc): any
  • In case of Python full output of pip list command, for other languages please provide BrainFlow version used

Expected behavior
Path should be resolved properly in electron packaged context for production.

** suggestion **
Init constructor differently, or add an electron support.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions