Closed deathcap closed 8 years ago
Getting this mysterious error from browserify on CircleCI - never seen this locally..
./app/node_modules/.bin/browserify app/app.js > app/wsmc/src/main/resources/www/bundle.js
Error: Cannot find module 'app/node_modules/browserify/node_modules/insert-module-globals/node_modules/is-buffer/index.js' from '/home/ubuntu/voxel-clientmc'
at /home/ubuntu/voxel-clientmc/app/node_modules/browserify/node_modules/resolve/lib/async.js:46:17
at process (/home/ubuntu/voxel-clientmc/app/node_modules/browserify/node_modules/resolve/lib/async.js:173:43)
at ondir (/home/ubuntu/voxel-clientmc/app/node_modules/browserify/node_modules/resolve/lib/async.js:188:17)
at load (/home/ubuntu/voxel-clientmc/app/node_modules/browserify/node_modules/resolve/lib/async.js:69:43)
at onex (/home/ubuntu/voxel-clientmc/app/node_modules/browserify/node_modules/resolve/lib/async.js:92:31)
at /home/ubuntu/voxel-clientmc/app/node_modules/browserify/node_modules/resolve/lib/async.js:22:47
./app/node_modules/.bin/browserify app/app.js > app/wsmc/src/main/resources/www/bundle.js returned exit code 1
at FSReqWrap.oncomplete (fs.js:82:15) Action failed: ./app/node_modules/.bin/browserify app/app.js > app/wsmc/src/main/resources/www/bundle.js
http://stackoverflow.com/questions/21685044/browserify-uncaught-error-cannot-find-module-in-bundle-js says this occurs when using a jison parser, sure enough https://github.com/rom1504/node-mojangson uses jison, but only as a dev dependency? Maybe its something else. The stackoverflow user says they fixed it in their case by "replacing that mindfuck exports part with a exports.parser = parser;"
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));
}
}
and its using https://github.com/deathcap/jison/commits/modulemain which has https://github.com/deathcap/jison/commit/83a38136e958c32de16630099946ebe0357ea605.. for https://github.com/rom1504/node-mojangson/pull/4 Disable unused moduleMain code for browserify compatibility
There are differences in npm ls
on voxel-clientmc/app, on my local system and circleci: https://gist.github.com/deathcap/1e530528e8fb3ae0d67b - mainly minor/patch version bumps
@deathcap I think I found your problem, the published grammar.js seems to still contain the cli thingy. republishing it in a bit.
@rom1504 cool thanks. reproduced locally was about to track it down =)
fixed in mojangson 0.2.3 just rerun circle ci (possibly without cache, not sure how it handle npm cache) and that should do it.
Updated and verified circleci is using mojangson 0.2.3 which has the main stub as expected:
exports.main = function (){};
so I think the problem with mojagson is fixed. Still getting this error though - maybe another problematic unbrowserifiable module:
voxel-clientmc $ ./app/node_modules/.bin/browserify app/app.js > app/wsmc/src/main/resources/www/bundle.js
Error: Cannot find module 'app/node_modules/is-buffer/index.js' from '/private/tmp/vc/voxel-clientmc'
at /private/tmp/vc/voxel-clientmc/app/node_modules/resolve/lib/async.js:46:17
at process (/private/tmp/vc/voxel-clientmc/app/node_modules/resolve/lib/async.js:173:43)
at ondir (/private/tmp/vc/voxel-clientmc/app/node_modules/resolve/lib/async.js:188:17)
at load (/private/tmp/vc/voxel-clientmc/app/node_modules/resolve/lib/async.js:69:43)
at onex (/private/tmp/vc/voxel-clientmc/app/node_modules/resolve/lib/async.js:92:31)
at /private/tmp/vc/voxel-clientmc/app/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:82:15)
ill need to isolate further..
https://github.com/voxel/voxel-clientmc/issues/31