带有USB模块的Node webkit应用程序失败
Node webkit application with USB module failing
我正在使用node-webkit编写一个桌面应用程序。我使用节点USB模块编写脚本,如果我使用节点运行该脚本,则该模块工作正常。它列出了所有usb设备,连接,读取,写入。现在我想实现相同的使用node-webkit应用程序,其中HTML有一个按钮,我们必须做这些事情。现在,我们需要配置节点模块。我已经将该模块添加到我的项目中,然后做了如上所述的处理
package.json
:
{
"name": "node-webkit-angular-bootstrap-starter",
"version": "0.0.1",
"description": "Starter destkop app using node-webkit, html5, angular, and bootstrap",
"main": "app/index.html",
"scripts": {
"test": "echo '"Error: no test specified'" && exit 1"
},
"author": "",
"license": "MIT",
"window": {
"title": "node-webkit-angular-bootstrap-starter",
"toolbar": true,
"frame": true,
"width": 1024,
"height": 768,
"position": "center"
},
"dependencies" : {
"node-pre-gyp": "0.6.9"
},
"bundledDependencies":["node-pre-gyp"],
"devDependencies": {
"aws-sdk": "~2.0.0-rc.15"
},
"scripts": {
"install": "node-pre-gyp install --fallback-to-build"
},
"binary": {
"module_name": "usb",
"module_path": "./app/lib/binding/",
"host": "https://github.com/camsoupa/node-usb"
}
}
Home.js
:
(function () { 'use strict'; app.controller('homeController', function ($scope) {alert("Heelooooo");
var gui = require('nw.gui');
var os = require('os');
$scope.settings = [];
$scope.usb = require('usb'); });})();
使用nw
运行应用程序时出现以下错误<>之前"%1不是有效的Win32应用程序。↵D: ' '项目……呃' node_modules ' u盘' src '绑定' usb_bindings.node"}之前有谁能帮我一下吗?我通过编译正确的体系结构解决了这个问题。在我的环境中,node是32位,而nw是64位。将目录更改为usb模块,下面两个命令通过创建64位版本的本机绑定解决了这个问题:
nw-gyp configure --target=0.12.3 --module_name=usb_bindings --module_path=..'src'binding' --target_arch=x64
nw-gyp build --target=0.12.3 --module_name=usb_bindings --module_path=..'src'binding' --target_arch=x64
module_name
和module_path
变量是必要的,因为无论出于何种原因,nw-gyp
没有从binding.gyp
文件中获得它们的值。
另一个可能导致您描述的错误的事情是将nw.exe
重命名为其他东西。只要命名为nw.exe
,符号就会正确绑定。
相关文章:
- 如何在构建node-webkit应用程序后获取外部资源
- 节点webkit应用程序与终端通话
- 如何保护节点webkit应用程序上的字体
- 如何从Node Webkit应用程序中退出外部CMD文件
- 在Node Webkit应用程序中从DOM单击按钮时运行批处理文件
- Angularjs在node-webkit应用程序中将image src更改为“unsafe:”
- Node webkit 应用程序在加载 Vimeo 视频时崩溃
- 如何从node-webkit应用程序打开浏览器窗口
- 如何从node-webkit应用程序启动新应用程序
- 如何在node-webkit应用程序中连接Web sql
- 如何使用JavaScript在node-webkit应用程序中从SoundCloud流式传输音乐
- 如何获取Node Webkit应用程序的临时解压缩目录
- Android或ios平台上的Node -WebKit应用程序
- 带有USB模块的Node webkit应用程序失败
- Node-webkit应用程序不工作在Windows 7 32位
- 在远程托管的node-webkit应用程序中使用require()
- 命令行node-webkit应用程序
- 在node-webkit应用程序中打包npm模块
- gapi.auth.authorize回调在node-webkit应用程序上通过谷歌登录时不被调用
- 正在打包节点webkit应用程序