Electron error using "escpos" and "Electron-rebuild": not a valid Win32 application

Asked

Viewed 254 times

2

I am developing a desktop application with Electron and I have the following problem when trying to run the application on Windows:

inserir a descrição da imagem aqui

All this started after I installed the framework "escpos" to work with thermal printer and "Electron-rebuild" because I needed to run a rebuild to make the framework work.

I am developing and compiling, for Windows, on a Linux (Debian) machine using Electron-packager.

Follow my package.json if you can help:

  "name": "app",
  "version": "1.0.0",
  "private": true,
  "main": "elect.js",
  "build": {
    "appId": "br.com.app"
  },
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "electron": "electron .",
    "package-linux": "electron-packager . app --overwrite --asar=true --platform=linux --arch=x64  --icon=src/assets/icons/icon-1024.png --prune=true --out=release-builds",
    "package-windows-32": "electron-packager . app --overwrite --asar=true --platform=win32 --arch=ia32 --icon=src/assets/icons/windows/logo-32x32.ico --prune=true --out=release-builds"
  },
  "dependencies": {
    "electron": "^4.1.1",
    "escpos": "^2.4.11",
    "express": "^4.16.4",
    "http": "0.0.0",
    "internet-available": "^1.0.0",
    "lodash": "^4.17.11",
    "path": "^0.12.7",
    "serialport": "^7.1.4",
    "serve-static": "^1.13.2",
    "vue": "^2.6.6",
    "vue-router": "^3.0.1"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^3.5.0",
    "@vue/cli-service": "^3.6.0",
    "electron-packager": "^13.1.1",
    "electron-rebuild": "^1.8.4",
    "vue-template-compiler": "^2.5.21"
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ]
}

Thank you in advance!

1 answer

0

After some time dealing, I solved the issue using a windows virtual machine to compile the application. However, there I also had some problems and followed the following steps to solve it:

  1. I installed Node-Gyp globally
  2. I installed version 2.7 of Python
  3. I configured Python with the following command: npm config set python "c:\Python27\python.exe"
  4. With a prompt in administrator mode surround the following commands: npm install --global --production windows-build-tools npm config set msvs_version 2015 --global

  5. I circled a rebuild: .\node_modules\.bin\electron-rebuild.cmd

  6. At last I circled a npm install

Browser other questions tagged

You are not signed in. Login or sign up in order to post.