Express框架给出了一个非常奇怪的错误 [英] Express framework giving a very strange error
问题描述
我正在尝试在节点中使用Express,安装所有好的,编译,得到了npm并安装了express:
I'm trying to use Express in node, install everything okay, compiled, got npm and installed express with:
npm安装表达
npm install express
问题是,每次我尝试需要它,它给我一个错误!
看看,一个简单的文件app.js为:
The problem is, everytime I try to "require" it, it gives me an error! Take a look, a simple file app.js as:
var express = require('express');
当我运行它:
tlab065:~/proj/Express-server-abstraction> node app.js
node.js:116
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot read property 'prototype' of undefined
at Object.<anonymous> (/people/home/jdomingues/local/node/lib/node/.npm/express/1.0.7/package/lib/express/server.js:87:44)
at Module._compile (module.js:373:26)
at Object..js (module.js:379:10)
at Module.load (module.js:305:31)
at Function._load (module.js:271:10)
at require (module.js:317:19)
at Object.<anonymous> (/people/home/jdomingues/local/node/lib/node/.npm/express/1.0.7/package/lib/express/index.js:28:31)
at Module._compile (module.js:373:26)
at Object..js (module.js:379:10)
at Module.load (module.js:305:31
有人可以帮我吗?为什么我得到这个错误?我可以如何安装不同版本的快递?
Can someone help me? Why am I getting this error? How can I maybe install a different version from express?
推荐答案
问题是你可能有最新的连接(而不是你需要安装最新的连接)命令@Shripad显示是有帮助的,将可能会显示你已连接1.0, yay ...呃哦,表达还没有准备好1.0连接,这样做回到0.5.10:
The issue is that you probably have the latest connect (as opposed to "you need to install the latest connect") the command @Shripad showed is helpful and will probably show you that you have connect 1.0, yay...uh oh express isn't quite ready for 1.0 connect, do this to go back to 0.5.10:
npm install connect@0.5.10
这篇关于Express框架给出了一个非常奇怪的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!