Skip to content
This repository has been archived by the owner on Mar 20, 2021. It is now read-only.

Can't create view in "hello_world" module #35

Closed
habuma opened this issue May 23, 2012 · 4 comments
Closed

Can't create view in "hello_world" module #35

habuma opened this issue May 23, 2012 · 4 comments
Assignees

Comments

@habuma
Copy link

habuma commented May 23, 2012

This may be a non-issue and may have more to do with me being a Thorax newbie, but...

I try "thorax view hello_world myview" and get the following error:

myapp% thorax view hello_world myview
created view: js/views/myview.js
created template: templates/myview.handlebars

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
TypeError: Cannot call method 'push' of undefined
    at [object Object].view (/usr/local/lib/node_modules/thorax/lib/cli.js:358:52)
    at Object.<anonymous> (/usr/local/lib/node_modules/thorax/lib/cli.js:231:20)
    at Object.<anonymous> (/usr/local/lib/node_modules/thorax/lib/cli.js:170:41)
    at Object.<anonymous> (/usr/local/lib/node_modules/thorax/bin/thorax:14:28)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Array.0 (module.js:479:10)
    at EventEmitter._tickCallback (node.js:192:40)

My initial thought was that it was because the module name has an underbar in it, but I was able to create another module with an underbar in it and add a view with no problems.

@ghost ghost assigned eastridge May 23, 2012
@habuma
Copy link
Author

habuma commented May 23, 2012

FWIW, I realize this is also probably a special case, as no real application would ever even keep the "hello_world" module, much less add views to it. But in the context of self-education and tutorials one might do this...and that error can be somewhat jarring for a newbie.

@habuma
Copy link
Author

habuma commented May 23, 2012

It seems this is because the canned "hello_world" module doesn't have a "files" collection to add the view script to. I manually added an empty "files" collection to that module in lumbar.json and tried again...it worked.

Which brings up another question: Why are the views and routers in the "scripts" collection for "hello_world" (which makes sense to me), but the thorax views command adds them to the "files" collection (which makes less sense to me). Why not put them in "scripts" instead of "files"? Not only would that make more sense, it would also fix the original problem I described.

@eastridge
Copy link
Contributor

Looks like I wrote the command line utils before the lumbar.json format came to be in it's present format. Updating those now and should have a fix out later today. Thanks for reporting this.

@habuma
Copy link
Author

habuma commented Jun 5, 2012

It appears that this has been fixed...shall I close the issue?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants