开发者

Nodejs / Express 'prototype' error

I have the following error while trying to start my node app:

TypeError: Cannot read property 'prototype' of undefined

Full error:

at Object.<开发者_如何转开发;anonymous> (/home/node/node_modules/express/lib/express/server.js:87:44)
    at Module._compile (module.js:432:26)
    at Object..js (module.js:450:10)
    at Module.load (module.js:351:31)
    at Function._load (module.js:310:12)
    at Module.require (module.js:357:17)
    at require (module.js:368:17)
    at Object.<anonymous> (/home/node/node_modules/express/lib/express/index.js:28:31)
    at Module._compile (module.js:432:26)
    at Object..js (module.js:450:10)

I have noted this previous question on the same error: Express framework giving a very strange error. I tried to install the older version of connect, but this did not work and I received the same error.

Node version: v0.5.9-pre


Based on the comments on your question, could you post the code you are using? you are most likely missing an app.use statement


It sounds like you're missing some dependencies. Add a package.json file to the root of your project directory

{
    "name": "myproject"
  , "version": "0.0.1"
  , "private": true
  , "dependencies": {
      "express": "2.4.6"
    , "ejs": ">=0.4.3" 
  }
}

Then, run npm install -d from the project directory. If you're using jade instead of ejs, change that line on the package.json to jade and it's current version.


I solved this by starting from scratch and re-installing node again with an older version 0.4.8.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜