I have a problem with loading node-modules in my node-webkit application.
For example module usb
(https://npmjs.org/package/usb).
It was successfully installed from npm (npm install usb --save-dev
) and works in simple Node.js, also it was successfully rebuilded by nw-gyp
for using in node-webkit.
I don't include node_modules
folder in my app.nw
, so after building using grunt, I have a following structure of files:
- app.exe
- nw.pak
- ffmpegsumo.dll
- icudt.dll
- libEGL.dll
- libGLESv2.dll
- [node_modules]
- [usb]
- binding.gyp
- package.json
- ...
- [build]
- [Release]
- usb_bindings.node
- usb_bindings.lib
- usb_bindings.bdb
- usb_bindings.exp
- [obj]
- ...
- [Release]
- [usb]
When I try to load this module in my appliacation, using following code:
var usb = require('usb');
I get an error
Error: Cannot find module 'usb'
Why node-webkit can't load this module?
p.s. All default modules like path
, url
, http
works.