nwjs / grunt-nw-builder

Build NW.js applications for Mac, Windows and Linux using Grunt

Home Page:https://www.npmjs.com/package/grunt-nw-builder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

image

However, when I attempt to run the application after running grunt-node-webkit-builder, I get the following errors:

image

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.