Browserify - uncaught error "cannot find module" in bundle.js

Getting the following:

Uncaught Error: Cannot find module 'C:\Users\SR71042\AppData\Roaming\npm\node_modules\browserify\node_modules\insert-module-globals\node_modules\process\browser.js' 

Does anyone have an idea? The module really is.

EDIT:

This only happens if I need a jison parser. http://zaach.imtqy.com/jison/try/ using:

parser = require('./calculator').parser

This is how jison performs the export part:

if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
    exports.parser = parser;
    exports.Parser = parser.Parser;
    exports.parse = function () {
        return parser.parse.apply(parser, arguments);
    };
    exports.main = function commonjsMain(args){
        if(!args[1]){
            console.log("Usage: "+args[0]+" FILE");
            process.exit(1)
        }
        var source=require("fs").readFileSync(require("path").normalize(args[1]),"utf8");
        return exports.parser.parse(source)
    };
    if (typeof module !== 'undefined' && require.main === module) {
        exports.main(process.argv.slice(1));
    }
}
+3
source share
1 answer

Solved by replacing this part of mindfuck with export using exports.parser = parser;

+1
source

All Articles