【发布时间】:2020-12-02 05:34:21
【问题描述】:
我是电子和串行端口的新手。我开始了一个简单的节点项目,刚刚安装了电子和串口,一切都很好,但是当我使用let serialport = require('serialport')时,它给出了上述错误。我什至没有在 index.html 页面的 javascript 中使用第二行代码。
我已经尝试并搜索了很多次它的解决方案,但找不到它。
我什至在https://github.com/electron/electron/issues/18397
"dependencies": {
"electron": "^9.2.0",
"serialport": "^9.0.1"
}
如果我使用
app.allowRendererProcessReuse = false
它给出了以下错误
Uncaught Error: The module '\\?\D:\newutkal\node_modules\@serialport\bindings\build\Release\bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 80. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
我也试过npm install 但同样的错误。
请用简单的步骤解释它的解决方案(如果可能的话,用编码术语)。
感谢您关注这个话题。 :)
【问题讨论】:
标签: javascript node.js electron serial-port node-modules