-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
cannot use native modules? #38
Comments
Thank you for your issues! If you can, please let me know more details? Your error message is apparently the difference between NODE_MODULE_VERSION 70 and 72. |
I have never been to create electron apps with custom native node binary, but I believe it is possible to do that. |
will get back with steps to reproduce—maybe it’s something obvious, since i’m not too familiar with electron. |
I have never used try |
From console, the command below is checking your native dependencies are always matched electron version: $ npx electron-builder install-app-deps |
Nextron v5 is out! $ npm install --global nextron@latest |
> electron-builder install-app-deps
• electron-builder version=21.0.15
• loaded configuration file=/Users/boneskull/projects/nextron-test/electron-builder.yml
• rebuilding native dependencies dependencies=@serialport/[email protected] platform=darwin arch=x64
• install prebuilt binary name=@serialport/bindings version=2.0.8 platform=darwin arch=x64
• build native dependency from sources name=@serialport/bindings
version=2.0.8
platform=darwin
arch=x64
reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information)
error=prebuild-install info begin Prebuild-install version 5.3.0
prebuild-install WARN install prebuilt binaries enforced with --force!
prebuild-install WARN install prebuilt binaries may be out of date!
prebuild-install info looking for cached prebuild @ /Users/boneskull/.npm/_prebuilds/73d12e-bindings-v2.0.8-electron-v70-darwin-x64.tar.gz
prebuild-install http request GET https://github.com/node-serialport/node-serialport/releases/download/v2.0.8/bindings-v2.0.8-electron-v70-darwin-x64.tar.gz
prebuild-install http 404 https://github.com/node-serialport/node-serialport/releases/download/v2.0.8/bindings-v2.0.8-electron-v70-darwin-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=5.0.6 runtime=electron arch=x64 libc= platform=darwin)
added 1221 packages from 632 contributors and audited 24062 packages in 27.001s
found 0 vulnerabilities It's obviously trying to use some prebuilt binary, which won't work. I get something like this:
I'm not sure how to make Trying the recommended
What version of Node.js should I be running these commands with? Should it matter? |
The steps I took here:
|
OK, I think I have an idea of what the problem is. The problem is that (correct me if I'm wrong) Node.js, OTOH, has However, you can use
Evidently, this confuses webpack too much about where the packages live... As much as I'd like to get this working, I'm gonna have to throw in the towel. |
Mmm..., this is a complex problem. |
I found the solution: $ npx electron-rebuild -f -v <electron-version> -w serialport |
These steps were so helpful :) |
@saltyshiomix Your solution isn't working for me, so let me try again from the start. Thanks for following up... I had given up on it |
@saltyshiomix see https://github.com/boneskull/nextron-serialport for example |
( In a dev environment, Next.js runs a server in a
|
Given the difficulties here, I'm thinking that Next (or Nuxt) isn't a great choice for what I'm doing, given its architecture. |
I sent a PR which shows how to use SerialPort :) |
@saltyshiomix's PR fixes the issue! I found that TL;DR: configure |
I guess I can put that config in |
@saltyshiomix Can you think of any way to make |
Sorry I'm not familiar to If we want to use server side scripts in the electron architecture, we must use the server scripts in the main process, not the renderer process. |
serialport is a Node.js module. It can't be used in the browser. There's nothing special about
I don't think that's right. As of Electron v5, using For example, I can do this in an <!DOCTYPE html>
<html>
<body>
<div class="container">
<ul id="ports"></ul>
</div>
</body>
<script>
(async () => {
const ports = await require('serialport').list();
ports.forEach(({comName}) => {
const li = document
.getElementById('ports')
.appendChild(document.createElement('li'));
li.textContent = comName;
});
})();
</script>
</html> Result: I think because in |
I think you are right. |
I think it's the best way to use server scripts whithin the main process if we want to use Next.js as the renderer process. |
That's also the conclusion I've come to. thanks for helping! |
When running
npm run dev
, I'm getting this fromnode-serialport
:I've tried installing
electron
and usingelectron-rebuild
, upgrading all my dependencies, and trying everything I could from the official tutorial but still get this message. Honestly, I have no idea how Electron is getting launched usingnpm run dev
...The text was updated successfully, but these errors were encountered: