1

I have a problem with NodeJS.express when I create a new package by using:

express test_web

It created successfully, but when I open localhost:3000 main page, it cannot access to parse method!

this is a full page what it come:

Express
500 TypeError: /Users/user/Documents/p/hello_test/views/index.jade:5 3| block content 4| h1= title > 5| p Welcome to #{title} Object #<Object> has no method 'parse'
at detect (/Users/user/Documents/p/hello_test/node_modules/jade/node_modules/with/index.js:33:22)
at addWith (/Users/user/Documents/p/hello_test/node_modules/jade/node_modules/with/index.js:8:28)
at parse (/Users/user/Documents/p/hello_test/node_modules/jade/lib/jade.js:105:11)
at Object.exports.compile (/Users/user/Documents/p/hello_test/node_modules/jade/lib/jade.js:142:9)
at Object.exports.render (/Users/user/Documents/p/hello_test/node_modules/jade/lib/jade.js:196:15)
at Object.exports.renderFile (/Users/user/Documents/p/hello_test/node_modules/jade/lib/jade.js:233:18)
at View.exports.renderFile [as engine] (/Users/user/Documents/p/hello_test/node_modules/jade/lib/jade.js:218:21)
at View.render (/Users/user/Documents/p/hello_test/node_modules/express/lib/view.js:76:8)
at Function.app.render (/Users/user/Documents/p/hello_test/node_modules/express/lib/application.js:506:10)
at ServerResponse.res.render (/Users/user/Documents/p/hello_test/node_modules/express/lib/response.js:803:7)

How can I solve this problem?


More generally, in case your data is not sorted like this (by lon and then by lat) and you want subdiv to include all levels of lot and lan, you could:

    CPUE <- data.frame(lon = as.vector(replicate(4, sample(13.5:22.5, 10, T))),
                       lat = as.vector(replicate(4, sample(seq(54, 56.25, 0.25), 10, T))))

    num <- findInterval(CPUE$lon, sort(unique(CPUE$lon)))
    lett <- findInterval(CPUE$lat, sort(unique(CPUE$lat)))

    CPUE$subdiv <- paste(num, LETTERS[lett], sep = "")

    CPUE
        lon   lat subdiv
    1  13.5 54.50     1C #this is the first possible "lon" and the third possible "lat"
    2  15.5 54.50     3C
    3  20.5 55.25     8F #this is the eigth possible "lon" and the sixth possible "lat"
    4  19.5 54.00     7A
    5  16.5 55.75     4H

NOTE: This approach won't work if (1) you don't want to include all possible levels of "lon" and "lat", and (2) your data is not sorted as posted.

EDIT

Maybe something like this?:

    CPUE <- data.frame(lon = sort(rep(13.5:22.5, 13)),
                       lat = rep(seq(54.25, 60.25, 0.5), 10))

    lat_names <- findInterval(CPUE$lat, sort(unique(CPUE$lat))) + 36

    lon_names <- as.vector(sapply(LETTERS, paste, 0:9, sep = ""))
    lon_names <- lon_names[match("G3", lon_names):length(lon_names)]
    lon_names <- lon_names[findInterval(CPUE$lon, sort(unique(CPUE$lon)))]

    CPUE$subdiv <- paste(lat_names, lon_names, sep = "")

    > CPUE
         lon   lat subdiv
    1   13.5 54.25   37G3
    2   13.5 54.75   38G3
    3   13.5 55.25   39G3
    4   13.5 55.75   40G3
    5   13.5 56.25   41G3
    6   13.5 56.75   42G3
    7   13.5 57.25   43G3
    8   13.5 57.75   44G3
    9   13.5 58.25   45G3
    10  13.5 58.75   46G3
    11  13.5 59.25   47G3
    12  13.5 59.75   48G3
    13  13.5 60.25   49G3
    14  14.5 54.25   37G4
    15  14.5 54.75   38G4
    16  14.5 55.25   39G4
    17  14.5 55.75   40G4
    18  14.5 56.25   41G4
    19  14.5 56.75   42G4
    20  14.5 57.25   43G4
    ....
4

1 に答える 1

1

このバージョン http://nodejs.org/dist/v0.10.21/node-v0.10.21.tar.gzをインストールすると、エラーはなくなります。

于 2013-10-20T09:28:51.290 に答える