0

View rendering issue

I have been going through some of the introductory tutorials and I have tried to create an android view,  but get the following error:

[MOJITO] (1333571512367) mojito-mu: Rendering template "/usr/share/nginx/mojito_apps/wishrepublic/mojits/HomepageMojit/views/index.android.mu.html"node.js:201        throw e; // process.nextTick error, or 'error' event on first tick              ^SyntaxError: Unexpected token ILLEGAL    at Object.compile (/usr/lib/nodejs/mojito/lib/app/libs/Mulib/mu/compiler.js:23:21)    at /usr/lib/nodejs/mojito/lib/app/libs/Mulib/Mu.js:50:44    at /usr/lib/nodejs/mojito/lib/app/libs/Mulib/mu/parser.js:22:17    at Array.0 (/usr/lib/nodejs/mojito/lib/app/libs/Mulib/mu/preprocessor.js:24:20)    at EventEmitter._tickCallback (node.js:192:40)

View template is

Android

status
{{status}}
data
some: {{#data}}{{some}}{{/data}}
Any ideas?

by
16 Replies
  • Can you show the object, ideally as JSON, that you are parsing into the view to render it?

    Thanks,
    Fabian
    0
  • This is the main call:
     
      index: function(ac) {
    ac.models.HomepageMojitModelFoo.getData(function(err, data) {
    if (err) {
    ac.error(err);
    return;
    }
    ac.assets.addCss('./index.css');
    ac.done({
    status: 'Mojito is working.',
    data: data
    });
    });
    }


    and data is populated from the model method as follows:
     
            getData: function(callback) {
                callback(null, { some: 'data' });
            }

    These are all pretty much as generated by mojito on creation.
    0
  • May I ask if you are using Windows? It seems people are reporting this issue on windows:
    http://developer.yahoo.com/forum/Yahoo-Mojito/Creating-mojito-on-windows/1333531797999-61191399-1cef-48e3-97f7-825fc505d3e7

    I tried exactly your code, yeah basically Mojito auto-generates all of that, and it works fine on my Mac with nodejs 0.6.14 and the current mojito from Github.
    0
  • This is on Linux - CentOS 6, node 0.6.14, mojito 0.3.1 (installed today). The same code works in index.mu.html but not index.android.mu.html. Weird.

    QUOTE(Fabian Frank @ 4 Apr 2012 2:50 PM)
    May I ask if you are using Windows? It seems people are reporting this issue on windows:
    http://developer.yahoo.com/forum/Yahoo-Mojito/Creating-mojito-on-windows/1333531797999-61191399-1cef-48e3-97f7-825fc505d3e7

    I tried exactly your code, yeah basically Mojito auto-generates all of that, and it works fine on my Mac with nodejs 0.6.14 and the current mojito from Github.
    0
  • Linux - CentOS 6, node 0.6.14, mojito installed today via npm (0.3.1 I think). Strange how it template works as index.mu.html but not as index.android.mu.html.
    0
  • I couldn't reproduce the problem on my Mac using index.android.mu.html and then using a Chrome with an Android user agent. Do you mind sharing a tarball/zip of your app? I might get around to putting Mojito on a Linux box later today or tomorrow.
    0
  • Here is a tgz file of the mojito app (contents of app directory) - http://dl.dropbox.com/u/71285182/test.tgz
    0
  • OK. Found the issue - line endings!!! DOS/Windows line endings on linux caused the issue. Strange.
    0
  • Great, sorry I didn't have the time to look at it earlier but I was suspecting some weird encoding issue like that, which gets lost when you copy/paste to the forums.

    QUOTE(Jude Insley @ 5 Apr 2012 1:11 PM)
    OK. Found the issue - line endings!!! DOS/Windows line endings on linux caused the issue. Strange.


    0
  • Great, I was suspecting something like that and that it gets lost when you copy/paste to the forum. Glad you found it. 
    0
  • Jude: can you open a ticket? Line endings shouldn't crash Mojito like that.

    QUOTE(Fabian Frank @ 8 Apr 2012 1:33 PM)
    Great, I was suspecting something like that and that it gets lost when you copy/paste to the forum. Glad you found it. 
    0

Recent Posts

in Yahoo! Mojito