-
-
Notifications
You must be signed in to change notification settings - Fork 999
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
TypeError: Third argument must be a function #2191
Comments
@Lovinity Encountered same problem. This problem was not found in serialport@9.0.3 + electron@8 though. |
Just for reference (this isn't really a solution, of course, if anything, it's an ugly hack): After encountering the same error, I was able to get it to work with Electron 11.1.0 and serialport in version 8.0.8 (after running Seeing
might, of course, mean, that a downgrade to an exact 9.0.3 might also have solved that problem, of course (I probably didn't properly specify the exact version, which has then lead me to believe 9.0.3 wasn't working either 😅 ). |
@pklaschka That's true it's a dirty solution. I unfortunately cannot rely on rebuild and must use prebuilt binaries due to limitations with concurrent jobs in the build tool I use (if I use matrices, not only does that drastically complicate things, but it might cost money too; so I have to build for all OSes on MacOS. And rebuild will only work for the MacOS build on MacOS). |
@pklaschka so you're saying the prebuilds for windows in v9.0.4 have an issue but if you rebuild them they work for you? |
No. With 9.0.4, the "Third argument must be a function" error occurs either way (also after rebuilding). I just mentioned |
That's frustrating, nothing about the serialport code has changed between those versions. |
Maybe a dependency update is breaking the build? |
Yeah, probably Nan which was required to build for the latest electron https://github.com/serialport/node-serialport/blob/master/packages/bindings/src/serialport_win.cpp#L314-L317 is probably the code you're hitting. It's the write callback, which is guaranteed to have a callback here https://github.com/serialport/node-serialport/blob/master/packages/bindings/lib/win32.js#L10 I'll take a peak at some of the build warnings from the c++, maybe they've changed how functions work or something. |
Same problem |
Same problem here. It used to work fine, and then I started playing around with EDIT: O.K. I have more details: COM port works fine in commit https://github.com/gbmhunter/ninjaterm-electron/commit/a02b89185891d9234b26c4473759231879581f2a Wait, it now works in https://github.com/gbmhunter/ninjaterm-electron/commit/69bd384161defe672378a1520314710c1abc3960, after I re-ran |
I encountered same problem, too and I found the reason that cause this issue. I used Electron 11.1, @serialport/bindings 9.0.4 (with serialport 9.0.4), electron-builder 22.9.1. The reason what occurs this issue is wrong prebuilt image of @serialport/bindings@9.0.4. By default, When I run the application after But after run the And I looked into the logs of So I add the option to force rebuild dependencies to the
Packing time was slightly slowed-down but it was my best solution to using the latest version of serialport. |
Well... that's promising, it means a problem with the build vs the source. I removed the existing builds and forced another one can you try it again? |
Tried with the latest built binding (bindings-v9.0.4-electron-v85-win32-x64), the "TypeError: Third argument must be a function" error still occurs. Tried to run electron-rebuild for serialport module, also failed #2194 |
um, work for me change electron version to 10.1.3。 demo here |
I just got a same result as @orange-beans after flush the npm cache.
|
I think the problem (or one of the problems) is you need to bump the version up. Those of us who already downloaded 9.0.4 have a cache of it, and npm is not going to fetch the corrected build binary unless the version is bumped to 9.0.5. Under semantic versioning, it is very bad practice to re-build something under the same version number. "Once a versioned package has been released, the contents of that version MUST NOT be modified. Any modifications MUST be released as a new version." |
Encountered the same problem with Electron 11.1.1 and Serialport 9.0.4. Adding |
It is a workaround for this issue: serialport/node-serialport#2191
Add
And run |
I am encountering this issue as well. I have Electron 11.2.3 and Serialport 9.0.4. |
@sammlapp Yes! Like this:
Run |
FWIW, upgrading from Electron 11 to Electron 12.0.2 solved this issue for me when all the other suggestions failed. |
I have been digging and have an interesting discovery here. I have created a very minimal project, which simply tries to open a serialport. And I can reproduce the issue when run with If inside
Then back in the the root folder I try the But, if I try it with the rebuild being At this point I was starting to be suspicious that beta.12 introduced a breaking change in the abi. For reference the node-abi project uses Some skimming of the git diff between those electron versions later, and I found this change electron v11.0.0-beta.11...v11.0.0-beta.12 So it looks like node-abi is giving out a version number that is broken. As for solutions, the quickest option would be to add |
Hi all When i do a rebuild it's fine on electron:serve but when I go to build it as a windows or mac app I get the error in the app. Is there anything I can do to get around this for now? |
This one |
same here. how can i always force rebuild this in prod build script whenever production build? |
For anyone reading I eventually got this working by using electron 10 and serialport 9.0.3 & rebuilding with electron-rebuild |
win10
"electron-rebuild -f -w serialport" works for me! |
Summary of Problem
(Please answer all 3)
Code to Reproduce the Issue
Versions, Operating System and Hardware
The text was updated successfully, but these errors were encountered: