Skip to content

Instantly share code, notes, and snippets.

@faddah
Created March 19, 2015 22:41
Show Gist options
  • Select an option

  • Save faddah/f2d684c0af1a35ebe1e2 to your computer and use it in GitHub Desktop.

Select an option

Save faddah/f2d684c0af1a35ebe1e2 to your computer and use it in GitHub Desktop.
errors whilst trying to browserify
/* * * * * * * * * *
here is the file, i'm trying to browserify, called dom2json.js —
* * * * * * * * * */
var fs = require('fs');
var parse = require('jsonml').parse;
var jsonML = parse(fs.readFileSync('/home/chronos/user/Downloads/code/say_media_quiz/dom2json.html'));
if(null === jsonML) {
throw new Error("Invalid DOM");
} else {
document.getElementById("final-result").innerHTML = JSON.stringify(jsonML);
console.log(JSON.stringify(jsonML));
}
/* * * * * * * * * *
when i attempt to browserify it on the command line, with —
$ browserify dom2json.js > dom2json-bundle.js
i get the following errors —
SyntaxError: Line 2: Unexpected token ILLEGAL while parsing /home/chronos/user/Downloads/code/say_media_quiz/node_modules/jsonml/node_modules/node-expat/build/Release/node_expat.node while parsing file: /home/chronos/user/Downloads/code/say_media_quiz/node_modules/jsonml/node_modules/node-expat/build/Release/node_expat.node
at Stream.end (/usr/local/.nvm/v0.10.36/lib/node_modules/browserify/node_modules/insert-module-globals/index.js:73:21)
at _end (/usr/local/.nvm/v0.10.36/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/through/index.js:65:9)
at Stream.stream.end (/usr/local/.nvm/v0.10.36/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/through/index.js:74:5)
at Transform.onend (/usr/local/.nvm/v0.10.36/lib/node_modules/browserify/node_modules/module-deps/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:523:10)
at Transform.g (events.js:180:16)
at Transform.emit (events.js:117:20)
at /usr/local/.nvm/v0.10.36/lib/node_modules/browserify/node_modules/module-deps/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:965:16
at process._tickCallback (node.js:442:13)
i don't understand what's going on. browserify was working fine from the command line before with the 'html2jsonml' module, but since i've been trying to use jsonml, i get the above errors. any help is appreciate. thank you.
* * * * * * * * * */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment