Error: MODULE_NOT_FOUND for required modules
craigshoemaker opened this issue · comments
When I run my application during development using the following command:
nw.exe .
...everything works as expected and when I open the developer tools I see this:
However, when I attempt to run the application after running grunt-node-webkit-builder, I get the following errors:
I understand that some modules that use C/C++ addons may require a rebuild, but that's certainly not the case for lodash and humanize-plus.
I have made my code available in this repository so you can see what I am doing. For quick reference, this is all the script is attempting to do:
(function () {
var attemptRequire = function(moduleName){
try {
var mod = require(moduleName);
console.log(moduleName + ' loaded');
} catch (ex){
console.log(ex);
}
};
attemptRequire('underscore');
attemptRequire('lodash');
attemptRequire('humanize-plus');
attemptRequire('fs');
attemptRequire('fs-extra');
attemptRequire('node-webkit-fdialogs');
}());
Any insight you can offer is appreciated.
Sorry for taking so long to get to this. Those modules would exist in /node_modules
but you don't tell grunt-nw-builder to put node_modules
in your app. See https://github.com/craigshoemaker/grunt-node-webkit-builder-test/blob/master/gruntfile.js#L12.