Search code examples
javascriptjquerymodel-view-controllerjavascriptmvc

steal/buildjs throws an error with no explanation during the build of an app - Javascript MVC


I am trying to do a build using steal/buildjs of Javascript MVC, which should wrap all js and css files into production.js and production.css, and it throws an error and just prints some function (I assume). I am doing it inside of terminal by calling

./js steal/buildjs appname/appname.html -to appBuild


And here's what I'm getting on the terminal (this is part of the error - the actual error is too long for stackoverflow - about 500+ lines - I'm pasting the beginning and the end of the error):

Building to appBuild/
!!!!!!!!!!! ERROR !!!!!!!!!!!

-tokens    = 
             function (prefix, suffix) {
                 var c;
                 var from;
                 var i = 0;
                 var length = this.length;
                 var n;
                 var q;
                 var str;
                 var result = [];
                 var prereg = true, self = this;
                 var make = function (type, value) {
                     prereg = (type == "operator" || type === "name") && (value === "return" || ("(,=:[!&|?{};".indexOf(value.charAt(value.length - 1)) >= 0));
                     return {type:type, value:value, from:from, to:i, toString:function () {
                         return "Type: " + type + ", value: " + value + ", from: " + from + ", to: " + i;
                     }, error:function (message) {
                         throw "steal/parse/tokens.js " + message + " with " + this.value + ".\n" + self.substr(this.from - 20, 70);
                     }};
                 };


                [ MORE STUFF RIGHT HERE ]

             }

-toJSON    = 
             function (key) {
                 return String(this);
             }

-equals$   = 
             function equals_2(other) {
                 return $equals_1(this, other);
             }

-getClass$ = 
             function getClass_32() {
                 return Ljava_lang_String_2_classLit;
             }

-hashCode$ = 
             function hashCode_4() {
                 return getHashCode_0(this);
             }

-toString$ = 
             function toString_8() {
                 return this;
             }

-typeId$   = 2

It's pretty difficult to debug without any proper error. Any ideas?


Solution

  • The error beginning wtih "-tokens =" is occurring due to an empty .ejs file. I have a very similiar app situation to that of shershams, so I am certain he was experiencing the same issue for the same reason. When I encountered the same error in my app, I knew there had to be a consistent problem. A developers advice about an empty file turned to be the cause. I searched for an empty file and found there to be an empty ejs. I inserted span tags and the build worked without a problem. Apparently any empty file that is stealed can cause the problem.