简体   繁体   English

使用电子usb和电子

[英]Using electron-usb with electron

I tried is to include electron-usb library into my electron-project. 我试过将electron-usb库包含到我的电子项目中。

When I execute npm start with require('electron-usb') in my index.html file an error occurs in the console: 当我在index.html文件中执行npm start with require('electron-usb')时,控制台中出现错误:

Uncaught Error: The specified procedure could not be found.
\\?\C:\Users\Me\Documents\GitHub\electron-quick-start-master\electron-quick-start-master\node_modules\electron-usb\build\Release\electron-v0.36-win32-x64\usb_bindings.node

This error occurs in the file ELECTRON_ASAR.js Click here to see it 文件ELECTRON_ASAR.js中发生此错误点击此处查看

What did I do wrong? 我做错了什么? I assume I have to somehow configure the module therewith it works with electron but I don't know how. 我假设我必须以某种方式配置模块,它与电子一起工作,但我不知道如何。

I had the same problem last year. 去年我遇到了同样的问题。 I solved it and use electron everyday to access various USB devices. 我解决了它并每天使用电子来访问各种USB设备。

my solution is to use current version of electron-usb with electron-prebuilt@1.0.2 It must be that version or lower. 我的解决方案是使用当前版本的electron-usb和electron-prebuilt@1.0.2它必须是那个版本或更低版本。 Reason is older versions of electron uses node ver 5.x. 原因是旧版本的电子使用节点版本5.x. Electron-usb does not work with Node greater than ver 5.x. Electron-usb不适用于大于版本5.x的Node。 It sucks cause I would like to use the newest features of latest Electron and node 7. 它很糟糕,因为我想使用最新的Electron和节点7的最新功能。

When I started this project a couple of years ago there was exactly zero info on the subject. 几年前,当我开始这个项目时,关于这个主题的信息完全没有。 I know how frustrating it can be. 我知道它有多么令人沮丧。 I Will be glad to help you getting started if you need it. 如果您需要,我很乐意帮助您入门。

This could be caused by a wrong Electron version (see this issue for a similar problem: kinect2 ) 这可能是由错误的Electron版本引起的(对于类似的问题,请参阅此问题: kinect2

Basically you should try compiling and running with the build script default version. 基本上你应该尝试使用构建脚本默认版本进行编译和运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM