Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'prototype' of undefined #127

Open
ramstein74 opened this issue Aug 29, 2012 · 13 comments
Open

Cannot read property 'prototype' of undefined #127

ramstein74 opened this issue Aug 29, 2012 · 13 comments

Comments

@ramstein74
Copy link

Today i tried to run a simple app to test zappa but after
npm install express
npm install zappa

i goto windows console with node

a=require('zappa')
i get the error
Cannot read property 'prototype' of undefined
at
zappa.js (65:15)
zappa.js(702:4)

@adriantoine
Copy link

Hi,

Zappa has not been updated by mauricemach for a long long time, now you should use https://github.com/zappajs/zappajs instead. You just have to replace require('zappa') by require('zappajs') and npm install zappajs instead of npm install zappa

For me, it solved this issue.

@ramstein74
Copy link
Author

ok, working now.
Other question, about inline views.
How to use inline views from other coffeescript files?

Thanks again

@adriantoine
Copy link

What do you mean by inline views? Do you mean including views from coffeecup files?

@ramstein74
Copy link
Author

yes, including views from coffee files

Thank you

2012/8/30 Adrien Antoine [email protected]

What do you mean by inline views? Do you mean including views from
coffeecup files?


Reply to this email directly or view it on GitHubhttps://github.com//issues/127#issuecomment-8151687.

@adriantoine
Copy link

To include coffeecup view, it's very simple:
@get '/': -> @render 'index'
It will load the index.coffee file inside the views sub directory.

@ramstein74
Copy link
Author

i have a vista1.coffee inside views to test
this is my vista1.coffee

@view vista1: ->
doctype 5
html ->
head ->
title 'vista inline layout'
body ->
h1 'vista inline layout'
@Body

when i call it in my app.coffee with
@get
'/1': ->
@render 'vista1',layout:no,foo :'testing'

i get the error
TemplateError: Error rendering
C:\testzappa\views/6dc9db10-f45f-4789-a520-d31aa7735eed/vista1.coffee:
Object # has no method 'view

I´m lost
:)

2012/8/30 Adrien Antoine [email protected]

To include coffeecup view, it's very simple:
@get '/': -> @render 'index'
It will load the index.coffee file inside the views sub directory.


Reply to this email directly or view it on GitHubhttps://github.com//issues/127#issuecomment-8153535.

@adriantoine
Copy link

In your vista1.coffee file, just put this: (without @view vista1: ->)

doctype 5
    html ->
      head ->
        title 'vista inline layout'
      body ->
        h1 'vista inline layout'

and display it with @render 'vista1'

If you want to use a layout, create a file views/layout.coffee containing this:

doctype 5
    html ->
      head ->
        title 'vista inline layout'
      body ->
        @body

and a view views/index.coffee containing:

h1 'vista inline layout'

Then render it with @render 'index' and it should have the same display.

You can find more information here:

Good luck ;-)

@ramstein74
Copy link
Author

Hello again
another problem with zappa( i guess)
in my external layout file in jade

!!! 5
html
head

  title Jadeout

body
script(src='
https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js')
script(src='
http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.1/underscore-min.js
')
script(src='
http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.1/backbone-min.js')
h1 JadeOut
!= body

Without the 3 line that import the javascript files it works ok but with
those 3 lines i get the error
ENOENT, no such file or directory
'C:\testzappa\views\ee500cc8-fe5a-456c-959f-da3dcbb54f63\jadeout.jade'

Is this related to how zappa reads the jade file?

Thank you once more

António
2012/8/30 Adrien Antoine [email protected]

In your vista1.coffee file, just put this: (without @view vista1: ->)

doctype 5
html ->
head ->
title 'vista inline layout'
body ->
h1 'vista inline layout'

and display it with @render 'vista1'

If you want to use a layout, create a file views/layout.coffee containing
this:

doctype 5
html ->
head ->
title 'vista inline layout'
body ->
@Body

and a view views/index.coffee containing:

h1 'vista inline layout'

Then render it with @render 'index' and it should have the same display.

You can find more information here:

Good luck ;-)


Reply to this email directly or view it on GitHubhttps://github.com//issues/127#issuecomment-8154685.

@ramstein74
Copy link
Author

Hello again
another problem with zappa( i guess)
in my external layout file in jade

!!! 5
html
head

  title Jadeout

body
script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js')
script(src='http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.1/underscore-min.js')
script(src='http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.1/backbone-min.js')
h1 JadeOut
!= body

Without the 3 line that import the javascript files it works ok but with those 3 lines i get the error
ENOENT, no such file or directory 'C:\testzappa\views\ee500cc8-fe5a-456c-959f-da3dcbb54f63\jadeout.jade'

Is this related to how zappa reads the jade file?

Thank you once more

@ramstein74
Copy link
Author

never mind i did it another way around.

Next issue

in the sample file chat.coffee i try to use backbone js and in the client section code:
i try
$ =>
class Task extends Backbone.Model
i can see from my browser console that backbone is loaded but if i try in browser console
var task= new Task;
i get

Task is not defined...

why is that?

thank you

@Radagaisus
Copy link

@ramstein74 coffee script automatically closures your code, so Task is only defined inside that closure. Try to define it as window.Task. If you have any more questions the repo has moved here.

@hickford
Copy link

hickford commented Oct 7, 2012

Meanwhile (until the compatibility fork is merged), the package zappa could be labelled as incompatible with Node 0.8.x (or whatever) in the package.json per https://npmjs.org/doc/json.html#engines

You can specify the version of node that your stuff works on:

{ "engines" : { "node" : ">=0.1.27 <0.1.30" } }

@Radagaisus
Copy link

@matt-hickford this project is not maintaned anymore, the zappajs fork is maintaned and works with 0.8.

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

No branches or pull requests

4 participants