How to run and pack external executable using Electron?

前端 未结 2 746
有刺的猬
有刺的猬 2021-01-05 21:14

For example, I have a compiled binary cudaDeviceQuery which returns a list of devices as JSON. Here\'s a piece of code:

export default function          


        
2条回答
  •  执笔经年
    2021-01-05 21:49

    Add this in package.json:

    "scripts": {
        "start": "electron .", "install": "electron-rebuild",
        "package-osx": "electron-packager . Node-RED --platform=darwin --arch=x64 --   out=build --overwrite",
        "package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --prune=true --out=release-builds",
        "package-win": "electron-packager . electron-serialport --overwrite --asar=true --platform=win32 --arch=x64 --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"CryptoApp\"",
        "package-linux": "electron-packager . electron-serialport --overwrite --asar=true --platform=linux --arch=x64 --prune=true --out=release-builds"
    },
    
    "dependencies": {
        "electron-packager": "^12.1.0",
        "electron-prebuilt": "^1.4.13",
    }
    

    In case of not working for windows use the following:

    "package-win": "electron-packager . electron-serialport --overwrite --asar=true --platform=win32 --arch=ia32 --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"CryptoApp\"",
    

    Thanks...

提交回复
热议问题