syntax error in built json
Opened this issue · 5 comments
I've been trying to get the source for this project to compile. After installing the correct version of java and maven I can run ./build.js
which finishes successfully, but when I run test/simple.js
or try:
> require('./compile.js')({ jsCode: [{src: 'const x = 1 + 2;'}] })
I get this error:
SyntaxError: Unexpected token : in JSON at position 1077462
at Object.parse (native)
at JLc (/home/substack/projects/closure-compiler-js/jscomp.js:2086:38)
at i4c (/home/substack/projects/closure-compiler-js/jscomp.js:5961:36)
at e4c (/home/substack/projects/closure-compiler-js/jscomp.js:7131:293)
at DJ (/home/substack/projects/closure-compiler-js/jscomp.js:1729:29)
at GJ (/home/substack/projects/closure-compiler-js/jscomp.js:3005:44)
at /home/substack/projects/closure-compiler-js/jscomp.js:3179:46
at module.exports (/home/substack/projects/closure-compiler-js/compile.js:31:15)
at repl:1:24
at sigintHandlersWrap (vm.js:32:31)
at sigintHandlersWrap (vm.js:96:12)
at ContextifyScript.Script.runInContext (vm.js:31:12)
at REPLServer.defaultEval (repl.js:308:29)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.<anonymous> (repl.js:477:10)
at emitOne (events.js:101:20)
at REPLServer.emit (events.js:188:7)
at REPLServer.Interface._onLine (readline.js:232:10)
at REPLServer.Interface._line (readline.js:574:8)
at REPLServer.Interface._ttyWrite (readline.js:851:14)
at ReadStream.onkeypress (readline.js:119:10)
at emitTwo (events.js:106:13)
at ReadStream.emit (events.js:191:7)
at emitKeys (internal/readline.js:385:14)
at next (native)
at ReadStream.onData (readline.js:947:36)
at emitOne (events.js:96:13)
at ReadStream.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:177:18)
at ReadStream.Readable.push (_stream_readable.js:135:10)
at TTY.onread (net.js:542:20)
The file that closure-compiler-js is attempting to parse appears to be: closure-compiler/target/classes/com/google/javascript/jscomp/resources.json
:
node closure-compiler/target/classes/com/google/javascript/jscomp/resources.json
module.js:561
throw err;
^
SyntaxError: /home/substack/projects/closure-compiler-js/closure-compiler/target/classes/com/google/javascript/jscomp/resources.json: Unexpected token : in JSON at position 1077462
at Object.parse (native)
at Object.Module._extensions..json (module.js:558:27)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.runMain (module.js:575:10)
at run (bootstrap_node.js:352:7)
at startup (bootstrap_node.js:144:9)
at bootstrap_node.js:467:3
The other json file from which this file is derived doesn't appear to have the same issue:
$ node closure-compiler/src/com/google/javascript/jscomp/resources.json && echo $?
0
There may still be a problem if you try to build the JS version from the GWT/Java source. The code that's deployed to NPM is fixed.
@MatrixFrog knows more.
This should have been fixed by google/closure-compiler@f21c592 -- can you check if you're synced past that commit?
I don't have that commit. What branch is that in?
It's on master, but it's in the main closure-compiler repo rather than this one. So you probably need to do something like:
git submodule init
git submodule update
cd closure-compiler
git pull
to get the submodule updated. My knowledge of git submodules is iffy, @samthor can probably help if that's not quite right. Then cd back to this repo:
cd ..
and build:
./build.js
Thanks, this fixed it.