Could-not locate bindings file error, for Electron Cpp-addon executable program

Viewed 176

I am new to electron and I am making a project in which I need to use cpp-addon for better performance. But when I build the electron project using 'electron-builder', I am unable to run the production software. I am getting this error: Error

When I am running the program (using npm start scripts) I am able to see it working this means the addon is built and called correctly. I tried to find previous issues related to this and try the changes given to them but nothing worked. I also checked the .node file is being created in build/Release folder

I am using electron-builder --> ^22.7.0

electron --> ^9.1.0

This is my binding.gyp file

{
 "targets": [
 {
     "target_name": "device_common_nep",
     "cflags!": [ "-fno-exceptions" ],
     "cflags_cc!": [ "-fno-exceptions" ],
     "sources": [ "addons/transceiver/device_common_nep.cc" ],
     "copies": [{
           "destination": "./build/",
           "files": [ "./public/**.*" ]
     }],
     "include_dirs": [
            "<!@(node -p "require('node-addon-api').include")",
            "<(module_root_dir)/external/libiio/include/"
     ],
     'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ],
     'libraries': ['libiio.lib'],
     'link_settings': {
             'library_dirs': ['<(module_root_dir)/external/libiio/MS64']
     },
     "ldflags": ["-liio"]
     }
   ]
  }

And my package.json file

{
 "name": "radio",
 "version": "0.1.0",
 "gypfile": true,
 "description": "",
 "author": "",
 "build": {
    "appId": "radiowaves.app",
    "npmRebuild": true,
    "nodeGypRebuild": true
 },
 "homepage": "./",
 "main": "./public/electron.js",
 "dependencies": {
    "@material-ui/core": "^4.11.0",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "binding": "^3.0.3",
    "bindings": "^1.5.0",
    "cross-env": "^7.0.2",
    "electron-is-dev": "^1.2.0",
    "node-addon-api": "3.0.0",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.1"
  },
  "scripts": {
    "react-start": "react-app-rewired start",
    "react-build": "react-app-rewired build",
    "react-test": "react-app-rewired test",
    "react-eject": "react-scripts eject",
    "electron-build": "electron-builder",
    "build": "npm run react-build && npm run electron-build",
    "dist": "electron-builder -w --x64 --ia32",
    "start": "concurrently \"cross-env BROWSER=none npm run react-start\" \"wait-on http://localhost:3000 && electron .\""
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "concurrently": "^5.2.0",
    "electron": "^9.1.0",
    "electron-builder": "^22.7.0",
    "react-app-rewired": "^2.1.6",
    "typescript": "^3.9.6",
    "wait-on": "^5.0.1"
  }
}
0 Answers
Related