-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracking Electron support #538
Comments
Same here |
I just got my electron today will investigate! what version of node are you using? Chris Williams @voodootikigod http://twitter.com/voodootikigod | GitHub The things I make that you should check out: Help me end the negativity on the internet, share this On Thu, Jun 4, 2015 at 11:05 AM, Gianluca Bonacin notifications@github.com
|
The code is simply a boilerplate: var app = require("app");
var BrowserWindow = require("browser-window");
var mainWindow = null;
app.on("window-all-closed", function () {
if (process.platform !== "darwin") {
app.quit();
}
});
app.on("ready", function () {
mainWindow = new BrowserWindow({
width: 960,
height: 600
});
mainWindow.loadUrl("file://" + __dirname + "/index.html");
mainWindow.on("closed", function () {
mainWindow = null;
});
mainWindow.openDevTools();
var SerialPort = require("serialport").SerialPort;
var serialPort = new SerialPort("TODO-TODO-EL-MEXICO!", {
baudrate: 57600
});
}); |
Same here I am using Ubuntu 14.04 LTS. I got this when I require serialport when i run in electron. [3512:0609/164117:INFO:CONSOLE(326)] "Uncaught Error: Cannot find module './node_modules/serialport/build/serialport/v1.4.10/Release/node-v43-linux-x64/serialport.node'", source: module.js (326) I didn't found this folder but I found './node_modules/serialport/build/serialport/v1.4.10/Release/node-v11-linux-x64/serialport.node' Node version: 0.10.25 |
Actually when I renamed the folder to ''node-v43-win32-ia32', this error shown: Uncaught Exception: maybe there is something wrong in the native module (serialport.node) |
I rename the folder too, and I get this: [3827:0609/165900:INFO:CONSOLE(134)] "Uncaught Error: Module did not self-register.", source: ATOM_SHELL_ASAR.js (134) |
I have same issue. When I installed serialport, it created folder 'node-v14-win32-x64' instead of 'node-v43-win32-ia32 Windows7 64bit |
Hey guys, apparently @usefulthink was able to get this to work by just changing how node-serialport built. I'm using it in my Electron setup right now and it's working well. Here's the link to the commit/fork: |
I've tried @usefulthink's commit, the folder problem is solved but my electron app still show this error: Uncaught Exception: The error comes from the binary (serialport.node), I wonder why. |
I didn't really test anywhere except for OSX 10.10 which was all that I needed. But as all I did was replacing node-pre-gyp with node-gyp that is from my understanding unlikely to be the problem. Unfortunately, its several years since I last worked with Windows, so no idea.. |
I couldn't find anything about it here, but that might cause such a problem - did you use |
yes, I've used electron-rebuild but the error still appeared |
Hey All, so the @usefulthink fork actually provided me with the insight into what is going with this and I would like to share it so everyone can understand it. Originally, node-serialport (this module) used a project called node-gyp directly to provide the instructions for compiling the module on various platforms (Windows, Mac, Linux, etc.). While it worked (assuming all necessary dependencies) it was a nightmare as for doing any form of mass installation because undoubtably the necessary dependencies (build tools, compiler, etc) were never installed. This project, node-serialport, quickly became swamped with tickets about how to install on Windows, Mac, and Linux. Due to this, we moved to using a project called node-pre-gyp, which allowed us to utilize pre-compiled binaries if they exist from a known location and fallback to the local build process if they do not. This was hooked into an elaborate build system using Travis-CI and AppVeyor to generate the necessary compiled versions for Windows, Mac, and Linux on each release published to npm. Things were happy at this point since people using Windows, Mac, and Linux without the build components could easily use node-serialport without even being aware of its native module nature. During this time period, the project formerly named node-webkit, now nw.js, started to evolve and gain traction. It utilized its own derivative fork/hack from node-gyp in order to build the necessary native componets which was named nw-gyp and this choice had ramifications that affected the compilation of other native modules. Needless to say, as people began trying to use it in combination with the node-serialport project things did not work smoothly. Until the NW.js team published the previously linked instructions for node-gyp and node-pre-gyp, this project was blamed for incompatibility and many issues were filed. Then the Atom editor was released. The Electron team that maintains the application framework around the Atom Editor updated to the latest version of Chromium around September, 2014, which consequentially broke compatibility with any and all node-gyp compiled modules. Similar to NW.js, the Electron team posted details about how build Electron with other native modules, but those native modules mostly were not aware of this. As such, many issues were filed against this and other project concerned about the compatibility of that project when they try to integrate with Electron. The general node.js leadership has not openly discussed this mainly because they do not maintain end-user facing native modules, honestly there aren't a tremendous number of them. For those of us that do maintain a native module, the constant hamster wheel is enough to drive one insane. Until a maintainer can explore the other project, there is a very real sense that it could be the fault/issue/incompatibility of the project being maintained since Node.js, io.js and the ecosystem changes so quickly and its too much to keep up with. At this point, here is the general state of the world:
Specifically for node-serialport, as the prime maintainer I will not be merging in modifications that take this project backwards (ala reverting to node-gyp). Also, I will not be integrating special cases to support new native environments that have broken compatibility without thorough testing in every execution environment we already support. In summary, maintaining a native module in node.js is a constant battle. The node community needs to hold projects that break native compilation compatibility accountable by encouraging those projects to ensure node-gyp and node-pre-gyp modules can still be included without issue or failure. |
Thank you so much for writing this! Fully agree. |
@voodootikigod I agree too, I think it makes sense for node-pre-gyp to resolve the issue on their side rather than you changing your project. In the meantime the work @usefulthink should get us by. @usefulthink @a-giovani17 Windows compiling does work, as that's where I'm doing my build. I'm using the 2013 compiler "--msvs_version=2013", with electron-rebuild for compiling running the command ".\node_modules.bin\electron-rebuild . --version=0.28.3". That downloads the 0.28.3 headers for electron and compiles against them. Granted, I've done a lot of other things to my setup environment. If you wiped my computer and told me to get it all working again at this point I would likely be doomed. :P |
@usefulthink just want to make sure the 'going backwards' is not a knock on you by any means (I like your solution in the short run 👍). Cheers! |
@voodootikigod no worries, I just needed it to work and did the ugliest hack I could think of. I wouldn't have thought of making a PR of it anyway, and I agree with you that this would indeed be moving backwards for this project :) |
I am struggeling a bit to find out what the compatible Electron prebuilt version is and I suspect it is related to this issue. Are you using 0.27.2 because that is the last compatible version (uses iojs v1)? Or is serialport or the @usefulthink his fork also compatible with iojs v2 and Electron > 0.27? I have tested serialport with iojs-v2 (without electron) and that seemed to work just fine, but somehow in combination with electron I haven't managed to make it work with versions > 0.27 Also running |
Hi @0x80, you should be able to install my forked-version with |
@usefulthink thanks! I've managed to make it work with 0.29.1. Your module didn't seem to be available in npm registry so I installed if from git. |
I'm still experiencing one major issue though. When I use serialport in combination with Electron, the CPU goes through the roof. The same code running on the same iojs version but as standalone only uses a very small percentage. The code does nothing but connect and read data coming from the port. I know the CPU load is not caused by things like logging or using the Electron IPC bus becuase I've cut out all overhead like that. I already mentioned it here #402. Any idea what might cause something like this? I realize this isn't really on topic but I am completely clueless. |
If anybody stumbles upon this while trying to use node-serialport with electron: there is a temporary solution in the form of the serialport-electron npm package. |
I believe this should help but have yet to confirm: mapbox/node-pre-gyp#175 |
@ddm I get the following message when I try to require
What version of node and electron are you using? I am using iojs-v2.0.1. Using
|
@vjpr I just tested it with iojs-v2.0.1 It works for the following versions:
I believe it should work with 0.30.8 without a change. Just let me know if you want me to publish I think electron > 0.30.x requires a change to serialport to work properly because of a v8 version change. |
Thanks! You are right, changing The regular |
This is what i did to make it work:
npm install -g node-pre-gyp
"scripts": {
"start": "electron .",
"postinstall": "cd node_modules/serialport && node-pre-gyp rebuild --target=1.3.4 --arch=x64 --dist-url=https://atom.io/download/atom-shell",
"rebuild:64": "cd node_modules/serialport && node-pre-gyp rebuild --target=1.3.4 --arch=x64 --dist-url=https://atom.io/download/atom-shell",
"rebuild:32": "cd node_modules/serialport && node-pre-gyp rebuild --target=1.3.4 --arch=ia32 --dist-url=https://atom.io/download/atom-shell"
} Note: change --target= electron-version-you-use
npm install -g serialport By default it will install x64 version build of serialport as i set in postinstall script. Now when you want to switch to 32bit build just fire below command. npm run rebuild:32 Hope this helps someone. Good Luck. 👍 |
I managed to get the serialport package working with Electron 1.4.12 on a Windows 10 x64 machine. Now I've the problem that the list function doesn't return anything:
Did someone stumbled over the same issue? There are USB devices connect to my machine because I can see them in the USB Device Tree Viewer. They are connected to a generic USB hub (one of my displays). |
Are the "USB devices" you speak of acting as COM ports? (Can you use a
terminal program like putty to connect to it?)
…-Jacob
On Jan 18, 2017 6:53 PM, "Fabian Deitelhoff" ***@***.***> wrote:
I managed to get the serialport package working with Electron 1.4.12 on a
Windows 10 x64 machine. Now I've the problem that the list function doesn't
return anything:
var serialPort = require("serialport"); serialPort.list(function (err,
ports) { console.log(err); console.log(ports); ports.forEach(function(port)
{ console.log(port.comName); console.log(port.pnpId);
console.log(port.manufacturer); }); });
Did someone stumbled over the same issue? There are USB devices connect to
my machine because I can see them in the USB Device Tree Viewer. They are
connected to a generic USB hub (one of my displays).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#538 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABjss9lJD2CZcTbwifn5c_3-5FQ-By6jks5rTrQmgaJpZM4E3qag>
.
|
Not sure, but it seems like I cannot connect via putty to it (it's a LEGO Mindstorms EV3). |
@fdeitelhoff just glancing at your sample code I don't see any obvious problems. I suspect that your OS is not treating it as a serial port device. This could be driver/configuration related. Note that I don't have and have never worked with this device, but based on a couple quick web searches it sounds like there are multiple interfaces for it (USB, Bluetooth, and WiFi). Though I can't be 100% certain, it looks like the USB interface acts as an HID (human input device) not a VCP (virtual com port) (see this .NET API for example). If that's the case, I would recommend trying the Bluetooth interface (once paired, your system should be able to see it as a serial/COM port) or Wi-Fi interface (not sure what the protocol is, but if it has the same capabilities then you could use the standard Node network API rather than relying on platform-specific extensions like node-serialport). HTH |
I think this issue should be closed, right? This is not an issue, haven't been for a long time cause node-serialport works just fine with Electron. The main problem is that of Electron, everyone who starts using Electron will have issues with native modules, and most issues in this thread is about getting native modules to work. |
I agree =)
…On Thu, Jan 19, 2017, 6:07 PM Jari Pennanen ***@***.***> wrote:
I think this issue should be closed, right? This is not an issue, hasn't
been a long time with node-serialport, it works just fine with Electron.
The main problem is that of Electron, everyone who starts using Electron
will have issues with native modules, and most issues in this thread is
about getting native modules to work.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#538 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABlbr9c_zmEIzFNctshzyGdoIywKg3wks5rT-zHgaJpZM4E3qag>
.
|
Many thanks to you all for your effort and patience. :) As @jacobq stated, the EV3 is a HIDClass device. That's the reason it won't work with serialport. I tried the WIFI interface and this seems to be working fine. Bluetooth is the next test candidate. |
I was having a similar problem when using webpack. I learned the hard way that binary files need to be excluded from webpack. The solution was shockingly simple. |
Hi there, I'm still having issues with this, mainly because this discussion it's not clear at all. I'm on Win10 x64, running the latest versions of node and electron. I tried a few of the tips suggested here but it's still not working. Could you please suggest which of the previous methods IS currently (July 2017) working? Or eventually, if there's some clear docs around which goes straight to the point (if not I'd be happy to produce one after I manage to have it running on my end)? |
Keep trying!
You need to keep trying different combinations until it works. Webpack with electron and native dependencies is tough to crack.
If your open source post your repo and maybe someone will help!
Try using a boiler plate. This was frustrating for me to but you need to exclude the native dependencies from being web packed. You can literally tell webpack to avoid with "exclude" in your package.json
Make sure you are using a two package.json config, checkout electron boilerplate for example. I'm about to integrate serial port with a production app for OpenBCI Electron hub. I'll post link here once I do, ping me in a week if I forget and youre still stuck.
Good luck! Keep trying!
AJ Keller
Push The World
… On Jul 17, 2017, at 12:52 PM, franz1900 ***@***.***> wrote:
Hi there, I'm still having issues with this, mainly because this discussion it's not clear at all. I'm on Win10 x64, running the latest versions of node and electron. I tried a few of the tips suggested here but it's still not working. Could you please suggest which of the previous methods IS currently (July 2017) working? Or eventually, if there's some clear docs around which goes straight to the point (if not I'd be happy to produce one after I manage to have it running on my end)?
Thank you.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@franz1900 I am using |
Hi there,
where I get the following errors in npm-debug.log
I have python 2.7 and Visual Studio 2017 and I've just installed C++ tools. I've also un the following
|
What does ffi have to do with installing serialport?
…On Mon, Jul 24, 2017, 6:38 AM franz1900 ***@***.***> wrote:
Hi there,
so I restarted everything from scratch. I'm following Cyantic post from
Oct '16. I'm stuck at step 6:
npm install ffi --save-dev
where I get the following errors in npm-debug.log
1388 info build G:\ART\nodejs\ardu\node_modules\ffi\node_modules\debug
1389 info linkStuff ***@***.***
1390 silly linkStuff ***@***.*** has G:\ART\nodejs\ardu\node_modules\ffi\node_modules as its parent node_modules
1391 verbose linkBins ***@***.***
1392 verbose linkMans ***@***.***
1393 verbose rebuildBundles ***@***.***
1394 verbose rebuildBundles [ 'ms' ]
1395 info install ***@***.***
1396 info postinstall ***@***.***
1397 verbose unlock done using C:\Users\Fran\AppData\Roaming\npm-cache\_locks\debug-e6b5658bafc3ef9c.lock for G:\ART\nodejs\ardu\node_modules\ffi\node_modules\debug
1398 info ***@***.*** Failed to exec install script
1399 verbose unlock done using C:\Users\Fran\AppData\Roaming\npm-cache\_locks\ref-42c84230165c03fd.lock for G:\ART\nodejs\ardu\node_modules\ffi\node_modules\ref
1400 verbose about to build G:\ART\nodejs\ardu\node_modules\ffi
1401 verbose unlock done using C:\Users\Fran\AppData\Roaming\npm-cache\_locks\ffi-afc147decab49347.lock for G:\ART\nodejs\ardu\node_modules\ffi
1402 verbose stack Error: ***@***.*** install: `node-gyp rebuild`
1402 verbose stack Exit status 1
1402 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:217:16)
1402 verbose stack at emitTwo (events.js:87:13)
1402 verbose stack at EventEmitter.emit (events.js:172:7)
1402 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
1402 verbose stack at emitTwo (events.js:87:13)
1402 verbose stack at ChildProcess.emit (events.js:172:7)
1402 verbose stack at maybeClose (internal/child_process.js:827:16)
1402 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
1403 verbose pkgid ***@***.***
1404 verbose cwd G:\ART\nodejs\ardu
1405 error Windows_NT 10.0.15063
1406 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "ffi" "--save-dev"
1407 error node v4.4.7
1408 error npm v2.15.8
1409 error code ELIFECYCLE
1410 error ***@***.*** install: `node-gyp rebuild`
1410 error Exit status 1
1411 error Failed at the ***@***.*** install script 'node-gyp rebuild'.
1411 error This is most likely a problem with the ref package,
1411 error not with npm itself.
1411 error Tell the author that this fails on your system:
1411 error node-gyp rebuild
1411 error You can get information on how to open an issue for this project with:
1411 error npm bugs ref
1411 error Or if that isn't available, you can get their info via:
1411 error
1411 error npm owner ls ref
1411 error There is likely additional logging output above.
1412 verbose exit [ 1, true ]
1413 verbose unbuild node_modules\ffi\node_modules\ref
1414 info preuninstall ***@***.***
1415 info uninstall ***@***.***
1416 verbose unbuild rmStuff ***@***.*** from G:\ART\nodejs\ardu\node_modules
1417 verbose unbuild rmStuff in G:\ART\nodejs\ardu\node_modules\ffi\node_modules
1418 info postuninstall ***@***.***
1419 silly gentlyRm G:\ART\nodejs\ardu\node_modules\ffi\node_modules\ref is being purged from base G:\ART\nodejs\ardu
1420 verbose gentlyRm don't care about contents; nuking G:\ART\nodejs\ardu\node_modules\ffi\node_modules\ref
1421 silly vacuum-fs purging G:\ART\nodejs\ardu\node_modules\ffi\node_modules\ref
1422 silly vacuum-fs quitting because other entries in G:\ART\nodejs\ardu\node_modules\ffi\node_modules
1423 verbose unbuild node_modules\ffi
1424 info preuninstall ***@***.***
1425 info uninstall ***@***.***
1426 verbose unbuild rmStuff ***@***.*** from G:\ART\nodejs\ardu\node_modules
1427 info postuninstall ***@***.***
1428 silly gentlyRm G:\ART\nodejs\ardu\node_modules\ffi is being purged from base G:\ART\nodejs\ardu
1429 verbose gentlyRm don't care about contents; nuking G:\ART\nodejs\ardu\node_modules\ffi
1430 silly vacuum-fs purging G:\ART\nodejs\ardu\node_modules\ffi
1431 silly vacuum-fs quitting because other entries in G:\ART\nodejs\ardu\node_modules
I have python 2.7 and Visual Studio 2017 and I've just installed C++
tools. I've also un the following
npm config set msvs_version 2017 --global
npm config set python /Python27/python.exe --global
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#538 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABlbkRSmjUJ2SjQW5-gphxbb-sdRjD8ks5sRJ5PgaJpZM4E3qag>
.
|
I honestly have no idea, I'm just following what was written before as it seems the only way to find how it works :) However if it's not needed I'll skip the step. Step 9, not sure what to do with this error
throws:
|
@franz1900 do you get any more meaningful error message(s) if you run |
I'm going to guess you need a higher version of node, it's probably a
default argument statement.
http://node.green/#ES2015-syntax-default-function-parameters
…---
Francis Gulotta
wizard@roborooter.com
On Mon, Jul 24, 2017 at 7:40 AM, franz1900 ***@***.***> wrote:
I honestly have no idea, I'm just following what was written before as it
seems the only way to find how it works :) However if it's not needed I'll
skip the step.
Step 9, not sure what to do with this error
.\node_modules\.bin\electron-rebuild
throws:
G:\ART\nodejs\ardu\node_modules\electron-rebuild\lib\src\rebuild.js:33
constructor(lifecycle, buildPath, electronVersion, arch = process.arch, extraModules = [], forceRebuild = false, hea
derURL = 'https://atom.io/download/electron', types = ['prod', 'optional'], mode = defaultMode) {
^
SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (G:\ART\nodejs\ardu\node_modules\electron-rebuild\lib\src\cli.js:16:19)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#538 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABlbh3Npdv5Yz_1DuAWXWQ8OMjJDfauks5sRKzvgaJpZM4E3qag>
.
|
@reconbot ok that seemed to be the issue with that. So, I'm still getting the "Could not locate the binding files" error when I run npm start. I see that the To recap the steps I've done so far.
I tried again on a total new project and now I get an error on
|
it's working!! (not sure how/why/when/what but it's working!) |
@franz1900 Can you recap what you've done? Because this "it's working" isn't helpful and can be found everywhere one the internet. |
@fdeitelhoff I was driving and I was going to do it now that I arrived home ;) System
these are the release I have
I've used
I already had
Steps
|
This looks like you're rebuilding the binaries, exactly what needs to happen
…---
Francis Gulotta
wizard@roborooter.com
On Mon, Jul 24, 2017 at 10:33 AM, franz1900 ***@***.***> wrote:
I was driving and I was going to do it now that I arrived home ;)
System
- Win10 Home x64 Build 15063
these are the release I have
- Node v6.11.1
- Electron v1.6.11
- npm v5.3.0
I've used
- Powershell (Admin) except for steps 11/12
I already had
- Python 2.7.3 installed in the computer
- Visual Studio 2017 installed with C++ tools (I also have win 8.1 SDK
and other things so I can't confirm what is necessary and what is not)
Steps
1. npm install electron --save-dev
2. set VCTargetsPath="C:\Program Files (x86)\MSBuild\Microsoft.Cpp\
v4.0\V140"
3. npm install -g node-gyp
4. npm install serialport --save-dev
5. npm install electron-rebuild --save-dev
6. .\node_modules.bin\electron-rebuild
7. del .\node_modules\nslog\build\Release\nslog.node (Previous stage
should give error)
8. MINGW64 to do the following 2 steps
9. rm -rf node_modules/serialport/build/Release/*
10. rm -rf node_modules/ffi/build/Release/*
11. exit (return to powershell)
12. .\node_modules.bin\electron-rebuild
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#538 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABlbvRm1VB-I9HbS3ogczz775fux3Weks5sRNVRgaJpZM4E3qag>
.
|
I have an Electron desktop app that requires some nodejs packages including serialport. But only serialport is failed to require.
I included it like this:
var SerialPort = require('serialport').SerialPort;
var sp = require('serialport');
But when I run it on Electron, it shows following error:
Error: Cannot find module 'C:\xampp\htdocs\simplemail-desktop\node_modules\serialport\build\serialport\v1.7.4\Release\node-v43-win32-ia32\serialport.node'
I've check that the folder actually doesn't exists. When I installed serialport, it created folder 'node-v14-win32-ia32' instead of 'node-v43-win32-ia32'. Maybe there is something wrong in the installation process. What should I do?
The text was updated successfully, but these errors were encountered: