- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试让我的 Windows Electron 应用程序与另一个设备建立稳定的蓝牙连接(“正常”蓝牙,而不是 BLE)。我已经被安装node-gyp困住了,但我终于正确安装了它(至少我这么认为)。现在我又陷入困境,需要一些提示才能继续。
我尝试了各种不同的库,但似乎没有什么对我有用。在尝试使用 Node 蓝牙(未能为 Electron 重建它)之后,我决定尝试一下蓝牙串行端口。但我又陷入了重建问题。
我遵循了 Bruce 在 this 上的建议侧面(在尝试了一些其他方法之后),但当我应该更改绑定(bind)中的变量属性时不得不停止。gypElectron 文件夹和 bluetooth-serial-port 文件夹都不包含此文件(我暂时将它们安装在不同的文件夹中,因为否则它们会相互覆盖)。
尝试使用node-gyprebuild --target=0.30.1 --dist-url=https://atom.io/download/atom-shell
重建蓝牙串行端口失败输出如下:
$ node-gyp rebuild --target=2.0.2 --dist-url=https://atom.io/download/atom-shell
gyp info it worked if it ends with ok
gyp info using node-gyp@3.7.0
gyp info using node@8.11.3 | win32 | x64
gyp info spawn C:\python27\python.EXE
gyp info spawn args [ 'C:\\Users\\sbraendle\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=auto',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\sbraendle\\Desktop\\Electron\\BluetoothTest\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\sbraendle\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\sbraendle\\.node-gyp\\iojs-2.0.2\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\sbraendle\\.node-gyp\\iojs-2.0.2',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\sbraendle\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\Users\\sbraendle\\.node-gyp\\iojs-2.0.2\\<(target_arch)\\iojs.lib',
gyp info spawn args '-Dmodule_root_dir=C:\\Users\\sbraendle\\Desktop\\Electron\\BluetoothTest',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\\Users\\sbraendle\\Desktop\\Electron\\BluetoothTest\\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp: binding.gyp not found (cwd: C:\Users\sbraendle\Desktop\Electron\BluetoothTest) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Users\sbraendle\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:345:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\sbraendle\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=2.0.2" "--dist-url=https://atom.io/download/atom-shell"
gyp ERR! cwd C:\Users\sbraendle\Desktop\Electron\BluetoothTest
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
实际设置是:
Win 7 x64
Node 8.11.3
node-gyp 3.7.0
Electron 2.0.2(不完全确定,但安装时是这么说的)。
或者,我也愿意接受其他关于如何与 Electron 建立蓝牙连接的方法,只要有人已经让它工作即可。
<小时/>我不知道我昨天做错了什么,但今天我重新安装了所有东西,这次 Electron 的安装似乎工作正常,蓝牙串行端口(或我的 Node 蓝牙)的安装也正常工作第二次尝试)。我尝试运行该应用程序而不添加任何对蓝牙的引用。程序正常启动。但是,一旦我添加像 const bluetooth = require('node-bluetooth');
这样的行,它就会在两种情况下( Node 蓝牙和蓝牙串行端口)崩溃,并出现以下错误:
$ npm start
> bluetoothtest@1.0.0 start C:\Users\sbraendle\Desktop\Electron\BluetoothTest
> electron .
App threw an error during load
Error: Das System hat keinen Meldungstext für die Meldungsnummer 0x%1 in der Meldungsdatei %2 gefunden.
\\?\C:\Users\sbraendle\Desktop\Electron\BluetoothTest\node_modules\node-bluetooth\build\Release\BluetoothSerialPort.node
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:172:20)
at Object.Module._extensions..node (module.js:671:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:172:20)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Module.require (module.js:586:17)
at require (internal/module.js:11:18)
at bindings (C:\Users\sbraendle\Desktop\Electron\BluetoothTest\node_modules\node-bluetooth\node_modules\bindings\bindings.js:76:44)
at Object.<anonymous> (C:\Users\sbraendle\Desktop\Electron\BluetoothTest\node_modules\node-bluetooth\index.js:3:48)
对错误消息中的德语感到抱歉:我想准确地复制它。对此的翻译是:
The system has not found any message text for the message number 0x% 1 in the message file% 2.
有什么建议吗?
最佳答案
我知道这个帖子是一年前打开的,但今天早上我遇到了同样的问题,最终让 Electron 与蓝牙串口一起工作!所以步骤如下:
删除 node_modules
文件夹和 package.lock
文件。
打开终端:npm install --save-dev electro@4.2.6
和 npm install --save-dev electro-rebuild
。
Note: The version of electron should be that exact version. Recent releases are built on Node 12 and this will fail to build the bluetooth library. You can learn more here: https://www.npmjs.com/package/electron-releases
也在您的终端中:npm install --save bluetooth-serial-port
。在撰写本文时,我的版本是 2.2.4。
将此脚本添加到您的 package.json 中:“脚本”:{“重建”:“Electron 重建”}
在您的终端中:npm install
,然后npm runrebuild
您的项目现在应该可以编译,并且您在 Electron 内部有一个工作的蓝牙串行端口模块。我使用 HC-06 收发器测试了该模块。
关于node.js - 让 Electron 与 Node 的蓝牙串行端口一起工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50860088/
我正在学习构建单页应用程序 (SPA) 所需的所有技术。总而言之,我想将我的应用程序实现为单独的层,其中前端仅使用 API Web 服务(json 通过 socket.io)与后端通信。前端基本上是
当我看到存储在我的数据库中的日期时。 这是 正常 。日期和时间就是这样。 但是当我运行 get 请求来获取数据时。 此格式与存储在数据库 中的格式不同。为什么会发生这种情况? 最佳答案 我认为您可以将
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我正在尝试使用backbone.js 实现一些代码 和 hogan.js (http://twitter.github.com/hogan.js/) Hogan.js was developed ag
我正在使用 Backbone.js、Node.js 和 Express.js 制作一个 Web 应用程序,并且想要添加用户功能(登录、注销、配置文件、显示内容与该用户相关)。我打算使用 Passpor
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 8 年前。 Improve this ques
我尝试在 NodeJS 中加载数据,然后将其传递给 ExpressJS 以在浏览器中呈现 d3 图表。 我知道我可以通过这种方式加载数据 - https://github.com/mbostock/q
在 node.js 中,我似乎遇到了相同的 3 个文件名来描述应用程序的主要入口点: 使用 express-generator 包时,会创建一个 app.js 文件作为生成应用的主要入口点。 通过 n
最近,我有机会观看了 john papa 关于构建单页应用程序的精彩类(class)。我会喜欢的。它涉及服务器端和客户端应用程序的方方面面。 我更喜欢客户端。在他的实现过程中,papa先生在客户端有类
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我是一个图形新手,需要帮助了解各种 javascript 2D 库的功能。 . . 我从 Pixi.js 中得到了什么,而我没有从 Konva 等基于 Canvas 的库中得到什么? 我从 Konva
我正在尝试将一些 LESS 代码(通过 ember-cli-less)构建到 CSS 文件中。 1) https://almsaeedstudio.com/ AdminLTE LESS 文件2) Bo
尝试查看 Express Passport 中所有登录用户的所有 session ,并希望能够查看当前登录的用户。最好和最快的方法是什么? 我在想也许我可以在登录时执行此操作并将用户模型数据库“在线”
我有一个 React 应用程序,但我需要在组件加载完成后运行一些客户端 js。一旦渲染函数完成并加载,运行与 DOM 交互的 js 的最佳方式是什么,例如 $('div').mixItUp() 。对
请告诉我如何使用bodyparser.raw()将文件上传到express.js服务器 客户端 // ... onFilePicked(file) { const url = 'upload/a
我正在尝试从 Grunt 迁移到 Gulp。这个项目在 Grunt 下运行得很好,所以我一定是在 Gulp 中做错了什么。 除脚本外,所有其他任务均有效。我现在厌倦了添加和注释部分。 我不断收到与意外
我正在尝试更改我的网站名称。找不到可以设置标题或应用程序名称的位置。 最佳答案 您可以在 config/ 目录中创建任何文件,例如 config/app.js 包含如下内容: module.expor
经过多年的服务器端 PHP/MySQL 开发,我正在尝试探索用于构建现代 Web 应用程序的新技术。 我正在尝试对所有 JavaScript 内容进行排序,如果我理解得很好,一个有效的解决方案可以是服
我是 Nodejs 的新手。我在 route 目录中有一个 app.js 和一个 index.js。我有一个 app.use(multer....)。我还定义了 app.post('filter-re
我正在使用 angular-seed用于构建我的应用程序的模板。最初,我将所有 JavaScript 代码放入一个文件 main.js。该文件包含我的模块声明、 Controller 、指令、过滤器和
我是一名优秀的程序员,十分优秀!