Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Cannot read property 'prototype' of undefined #127

Open
ramstein74 opened this Issue · 13 comments

4 participants

@ramstein74

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

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

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

Thanks again

@adriantoine

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

@ramstein74
@adriantoine

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

@ramstein74
@adriantoine

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
@ramstein74

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

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

@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

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

@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
Something went wrong with that request. Please try again.