Replies: 4 comments
-
I'm really not that familiar with Electron or Cordova Electron for that matter, so I'm not very confident in this answer, but for the sake of maybe pointing you in the right path... I believe the root (project-level) package.json / node_modules are for the project and is not brought into electron. Electron platform (likely inside |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer. I am gonna test this evening by including the package serialport directly in the json of cordova application? |
Beta Was this translation helpful? Give feedback.
-
So, after some tests, the problem still persist. I'm closing this discussion because I won't use anymore cordova-electron for this project. |
Beta Was this translation helpful? Give feedback.
-
For additional information to anyone trying to use npm packages with thier Cordova-Electron app, a Cordova Plugin needs to be created. For example: We can look at the Cordova Device Plugin that added support for Electron and uses an npm package. In the case of the device plugin, you will see it including the npm package Device plugin PR for reference: apache/cordova-plugin-device#135 Note: The exported code in The device plugin is not an advance plugin, but I hope this information gives a good a starting point. |
Beta Was this translation helpful? Give feedback.
-
Hello everyone.
Since two days, I faced an issue and I don't understand what is it.
My goal is to use the library serialport.io in a cordova-app.
So the issue is really easy to reproduce :
Create a projet with cordova-electron
Add serialport
Update sampleApp/platforms/electron/platform_www
Try it with
That work and the console.log is make.
Build the project with
There are no errors
But when you try to open the executable (for exemple in window, it is
in /sampleApp/platforms/electron/build/win-unpacked/HelloCordova.exe, this error message is displayed
I use serialport : 12.0.0 ,Ubuntu : 22.04 ,cordova-electron : 3.1.0 ,cordova : 12.0.0 and react:18.2.0.
Did everyone has faced the same issue here ?
Documentation cordova-electron
Documentation SerialPort.io
Beta Was this translation helpful? Give feedback.
All reactions