I am writing an desktop application using node-webkit. I have written script using Node USB module which is working fine if i run that script using node. It lists all usb devices , connects,reads,writes. Now I want to achieve same using node-webkit application where HTML has a button on which we have to do these things. Now for this we require to configure node modules. I have added that module to my project and then did process as mentioned
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'); });})();
I am getting following error for running the application using nw
"%1 is not a valid Win32 application. ↵D:\Projects\…er\node_modules\usb\src\binding\usb_bindings.node"}
Can some one please help me?