很抱歉这么长的帖子,我一直在谷歌上搜索很多解决方案,但是找不到。我试图编写一个简单的电子应用程序来显示html页面(谢天谢地,这没有问题),并控制打印机,这件事必须通过通过npm安装的usb模块完成。这个模块和依赖于它的代码在纯node.js软件中总是完美地工作,所以这不是寻找问题的地方,但是我很难将它集成到我的电子应用程序中。我必须使用Ubuntu14.04,系统已经有节点12.20.0 +NPM6.14.8,这两个节点都是通过nvm安装的,没有任何警告(如果有任何已知的冲突,我可以安装不同的版本)。由于使用通过npm安装的电子的一系列困难,我求助于使用它的预构建的二进制包(版本11.1.1,但如果需要的话也可以更改),可以从https://github.com/electron/electron/releases/tag/v11.1.1下载。
我要做的是:
there
我得到的是:
./electron: /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0: no version information available (required by ./electron)
/home/totem/totem/electron: /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0: no version information available (required by /home/totem/totem/electron)
/home/totem/totem/electron: /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0: no version information available (required by /home/totem/totem/electron)
Fontconfig warning: "/etc/fonts/fonts.conf", line 86: unknown element "blank"
A JavaScript error occurred in the main process
Uncaught Exception:
Error: The module '/home/totem/totem/resources/app/node_modules/usb/build/Release/usb_bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 85. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1812)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1203:18)
at Object.func [as .node] (electron/js2c/asar_bundle.js:5:1812)
at Module.load (internal/modules/cjs/loader.js:992:32)
at Module._load (internal/modules/cjs/loader.js:885:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12738)
at Module.require (internal/modules/cjs/loader.js:1032:19)
at require (internal/modules/cjs/helpers.js:72:18)
at bindings (/home/totem/totem/resources/app/node_modules/bindings/bindings.js:112:48)
at Object.<anonymous> (/home/totem/totem/resources/app/node_modules/usb/usb.js:1:57)
Segmentation fault好的,这是可以理解的,因为usb是一个本机模块,必须重新构建。folder/resources/app
。
An unhandled error occurred inside electron-rebuild
Unable to find electron's version number, either install it or specify an explicit version
Error: Unable to find electron's version number, either install it or specify an explicit version
at /home/totem/totem/resources/app/node_modules/electron-rebuild/lib/src/cli.js:82:1911.1.1
./electron: /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0: no version information available (required by ./electron)
/home/totem/totem/electron: /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0: no version information available (required by /home/totem/totem/electron)
/home/totem/totem/electron: /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0: no version information available (required by /home/totem/totem/electron)
Fontconfig warning: "/etc/fonts/fonts.conf", line 86: unknown element "blank"
A JavaScript error occurred in the main process
Uncaught Exception:
Error: The module '/home/totem/totem/resources/app/node_modules/usb/build/Release/usb_bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 85. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1812)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1203:18)
at Object.func [as .node] (electron/js2c/asar_bundle.js:5:1812)
at Module.load (internal/modules/cjs/loader.js:992:32)
at Module._load (internal/modules/cjs/loader.js:885:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12738)
at Module.require (internal/modules/cjs/loader.js:1032:19)
at require (internal/modules/cjs/helpers.js:72:18)
at bindings (/home/totem/totem/resources/app/node_modules/bindings/bindings.js:112:48)
at Object.<anonymous> (/home/totem/totem/resources/app/node_modules/usb/usb.js:1:57)发生什么事了呢?就像电子重建什么都没做。我可以改变一切,除了操作系统和(除非没有其他解决方案可用),我使用电子预建包,而不是在$npm安装电子。你知道怎么回事吗?谢谢大家的关注。
发布于 2021-01-01 14:55:26
你必须重建任何
npm rebuild
# or
npm install electron-rebuild --save-dev
./node_modules/.bin/electron-rebuildhttps://stackoverflow.com/questions/65529165
复制相似问题