Node-serialport: %1 is not a valid Win32 application

Created on 25 Jul 2018  Â·  9Comments  Â·  Source: serialport/node-serialport

Hi
I am creating electron app for windows, and I'm using serialport in newest version.
When I run electron - everything works, but when I build package for win and run exe file I get
"%1 is not a valid Win32 application"

I checked another issues about that problem, and I changed node 10 to node 8, also I read that I can use prebuilds (how to use them?)

My package.json:

{
"name": "qbiz-fisk",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"start": "electron .",
"install": "electron-rebuild",
"package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --icon=src/images/app.ico --prune=true --

out=release-builds",
"package-win": "electron-packager . --overwrite --asar=true --platform=win32 --arch=ia32 --icon=src/images/app.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"QBIZFisk\"",
"package-linux": "electron-packager . --overwrite --platform=linux --arch=x64 --icon=src/images/app.ico --prune=true --out=release-builds"
},
"author": "",
"license": "ISC",
"dependencies": {
"@serialport/parser-delimiter": "^1.0.5",
"ascii-hex": "^1.0.1",
"diacritics": "^1.3.0",
"graceful-fs": "^4.1.11",
"hex2ascii": "0.0.3",
"request": "^2.87.0",
"serialport": "^6.2.2"
},
"devDependencies": {
"electron": "^2.0.0",
"electron-packager": "^12.0.2",
"electron-rebuild": "^1.7.3"
}
}

I have node v8.11.3 - I tried build it on Windows 10 and on Kubuntu with wine - I have the same result :/
Any sugestions?

stale-issue support

Most helpful comment

Thanks again!
Is there anything else I need to do to make the prebuilds work? When I simply replace the serialport/build/Release folder with the prebuild and package again, I get a new error:

E:\myProject-win32-x64\resources\app.asar\node_modules\bindings\bindings.js:88 Uncaught Error: Specified procedure could not be found.
\\?\C:\Users\Jannis\AppData\Local\Temp\20846e50-a2ab-4022-93fb-e0afd93be4d5.tmp.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:172:20)
    at Object.Module._extensions..node (module.js:671:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:186:18)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:504:12)
    at Function.Module._load (module.js:496:3)
    at Module.require (module.js:586:17)
    at require (internal/module.js:11:18)
    at bindings (E:\myProject-win32-x64\resources\app.asar\node_modules\bindings\bindings.js:81:44)
    at Object.<anonymous> (E:\myProject-win32-x64\resources\app.asar\node_modules\serialport\lib\bindings\win32.js:2:36)

I tried both the electronand node prebuild (the latter gives a different error, but I guess it's the wrong one anyway?). I also tried rebuilding after inserting the prebuild and that just seems to overwrite it, resulting in the old error.
What am I doing wrong?

All 9 comments

I'm facing the same issue. I'll try to play with virtual Win 10, Mac build was fine.

EDIT:

After all I've been able to build it under Win! 🚀

Firstly, install this (https://github.com/felixrieseberg/windows-build-tools)

npm --add-python-to-path --debug install --global windows-build-tools

then you should be able to rebuild native dependencies

npm rebuild

I resolved problem by building app on Win10 with nodejs terminal which I run as administrator and than all started to work.
At windows I needed to install additional packages.
Steps which I have done:

npm i --global-production windows-build-tools
npm i 
npm run package-win

where package-win is:
```
electron-packager . --overwrite --asar=true --platform=win32 --arch=x64 --icon=src/images/app.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"AppName\"
````

I am having the same Issue (Electron 2.0.3, Serialport 6.2.2, using electron-rebuild 1.8.2 and packaging for Windows with electron-packager under Xubuntu).

Setting up a node and a whole new build environment under Windows seems like a rather tedious workaround. Is there currently any way to build a project with serialport for Windows under Linux?

We do provide prebuilds under the releases tab on GitHub

On Wed, Aug 22, 2018, 3:40 PM Jannis notifications@github.com wrote:

I am having the same Issue (Electron 2.0.3, Serialport 6.2.2, using
electron-rebuild https://github.com/electron/electron-rebuild 1.8.2 and
packaging for Windows with electron-packager
https://github.com/electron-userland/electron-packager under Xubuntu).

Setting up a node and a whole new build environment under Windows seems
like a rather tedious workaround. Is there currently any way to build a
project with serialport for Windows under Linux?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/node-serialport/node-serialport/issues/1610#issuecomment-415206464,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABlbgqLQnbfe443WkzDgbBwPFUDrBu0ks5uTd3wgaJpZM4VfgON
.

Ah, thanks! Could you maybe point me to any resources on how to use prebuilds? I can find nothing online, unfortunately.
Also, this might be stupid question, but in the filenames of the prebuilds (e. g. serialport-v6.2.2-node-v46-win32-x64.tar.gz), what does node-v46 mean? I guess it is related to the version of node, but how?

it's process.versions.modules

you can run node -p process.versions.modules to check yours or just

console.log it from wherever you're using node

Francis Gulotta
[email protected]

On Wed, Aug 22, 2018 at 4:21 PM Jannis notifications@github.com wrote:

Ah, thanks! Could you maybe point me to any resources on how to use
prebuilds? I can find nothing online, unfortunately.
Also, this might be stupid question, but in the filenames of the prebuilds
(e. g. serialport-v6.2.2-node-v46-win32-x64.tar.gz), what does node-v46
mean? I guess it is related to the version of node, but how?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/node-serialport/node-serialport/issues/1610#issuecomment-415218923,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABlbk4W6tY83n4OT-vl8mz-DRnF9pGyks5uTedngaJpZM4VfgON
.

when you untar it it should live in the
./node_modules/serialport/build/Release/serialport.node


Francis Gulotta
[email protected]

On Wed, Aug 22, 2018 at 8:18 PM Francis Gulotta wizard@roborooter.com
wrote:

it's process.versions.modules

you can run node -p process.versions.modules to check yours or just

console.log it from wherever you're using node

Francis Gulotta
[email protected]

On Wed, Aug 22, 2018 at 4:21 PM Jannis notifications@github.com wrote:

Ah, thanks! Could you maybe point me to any resources on how to use
prebuilds? I can find nothing online, unfortunately.
Also, this might be stupid question, but in the filenames of the
prebuilds (e. g. serialport-v6.2.2-node-v46-win32-x64.tar.gz), what does
node-v46 mean? I guess it is related to the version of node, but how?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/node-serialport/node-serialport/issues/1610#issuecomment-415218923,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABlbk4W6tY83n4OT-vl8mz-DRnF9pGyks5uTedngaJpZM4VfgON
.

Thanks again!
Is there anything else I need to do to make the prebuilds work? When I simply replace the serialport/build/Release folder with the prebuild and package again, I get a new error:

E:\myProject-win32-x64\resources\app.asar\node_modules\bindings\bindings.js:88 Uncaught Error: Specified procedure could not be found.
\\?\C:\Users\Jannis\AppData\Local\Temp\20846e50-a2ab-4022-93fb-e0afd93be4d5.tmp.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:172:20)
    at Object.Module._extensions..node (module.js:671:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:186:18)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:504:12)
    at Function.Module._load (module.js:496:3)
    at Module.require (module.js:586:17)
    at require (internal/module.js:11:18)
    at bindings (E:\myProject-win32-x64\resources\app.asar\node_modules\bindings\bindings.js:81:44)
    at Object.<anonymous> (E:\myProject-win32-x64\resources\app.asar\node_modules\serialport\lib\bindings\win32.js:2:36)

I tried both the electronand node prebuild (the latter gives a different error, but I guess it's the wrong one anyway?). I also tried rebuilding after inserting the prebuild and that just seems to overwrite it, resulting in the old error.
What am I doing wrong?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week no further activity occurs. Feel free continue the discussion or ask for a never-stale label to keep it open. If this is a support issue, consider sharing it on stack overflow to get more eyes on your problem.

Was this page helpful?
0 / 5 - 0 ratings