diff --git a/lib/jison.js b/lib/jison.js index d078056ee..876b3a2fc 100755 --- a/lib/jison.js +++ b/lib/jison.js @@ -1280,7 +1280,12 @@ function commonjsMain (args) { console.log('Usage: '+args[0]+' FILE'); process.exit(1); } - var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); + var source = ''; + var fs = require('fs'); + var path = require('path'); + if (typeof fs !== 'undefined' && fs !== null && typeof path !== 'undefined' && path !== null) { + source = fs.readFileSync(path.normalize(args[1]), "utf8"); + } return exports.parser.parse(source); }