Over the last several days, I’ve been trying to use Sencha Command to package a Sencha Touch 2 app as a native app. Honestly, for most of the process, everything worked perfectly…until I actually had to package the app. I ran the build command, like so:

sencha app build native

Throughout the build process, everything seemed to be going well, until the minification of the actual app.js file. Here’s the error I received:

[ERROR] Error: Command failed:
[ERROR] 28305:18:missing variable name
[ERROR] 28305:20:syntax error
[ERROR] 28306:25:syntax error
[ERROR] 28318:14:identifier is a reserved word
[ERROR] 28420:21:identifier is a reserved word
[ERROR] 1:0:Compilation produced 5 syntax errors.
org.mozilla.javascript.EvaluatorException: Compilation produced 5 syntax errors. at com.yahoo.platform.yui.compressor.YUICompressor$1.runtimeError(YUICompressor.java:154) at org.mozilla.javascript.Parser.parse(Parser.java:392) at org.mozilla.javascript.Parser.parse(Parser.java:337) at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:312) at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:533) at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:131) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)

Pretty helpful, right?

Well, I *finally* figured it out. I emphasize “finally”, as the issue was actually a code error on my part. In my app, I used the word “final” as a variable in one of my controllers. Apparently, this is a reserved word (or something like that), and so the minifier blew up. Changing the variable name resolved all the issues.

So how many hours of frustration was that? I am stupid.

Share More >