In reference to this question (browserify 'Error: Cannot find module' in trying to fix 'Uncaught reference error: require is not defined'), I got the browserify command to work thanks to stackoverflow community, however, I got another error that tells me
Uncaught TypeError: undefined is not a function bundle.js:10786
Mime.load bundle.js:10786
(anonymous function) bundle.js:10822
_process bundle.js:10848
I believe the function it is complaining about is the 'fs.readFileSync' function. Here is the line 10786 in my 'bundle.js' file
Mime.prototype.load = function(file) {
this._loading = file;
// Read file and split into lines
var map = {},
content = fs.readFileSync(file, 'ascii'), <---LINE 10786
lines = content.split(/[\r\n]+/);
lines.forEach(function(line) {
// Clean up whitespace/comments, and split into fields
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/);
map[fields.shift()] = fields;
});
this.define(map);
this._loading = null;
};
-dor--debugflag to browserify will enable source maps, this makes it a lot easier to determine where errors occur in your code.browserify -d app/index.js > app/bundle.js