启动express代理服务器时出错

我想要启动一个如下所示的JavaScript Express代理服务器:

var express = require("express"), http = require("http"), port = (process.env.PORT || 8001), server = module.exports = express(), httpProxy = require('http-proxy'); var proxy = httpProxy.createProxyServer(); // SERVER CONFIGURATION // ==================== server.configure(function() { server.use(function(req, res, next) { if (req.url.indexOf('/bla') === 0) { //console.log(res); proxy.web(req, res, {target: 'http://bla.blabla.net'}); } else { next(); } }); server.use('/bla', express["static"](__dirname + "/../public")); server.use(express.errorHandler({ dumpExceptions: true, showStack: true })); server.use(express.bodyParser()); server.use(server.router); }); // Start Node.js Server http.createServer(server).listen(port); 

它曾经工作没有问题,但现在它失败了,虽然我没有改变代码。 我得到这个错误消息:

util.js中:634

ctor.prototype = Object.create(superCtor.prototype,{^

TypeError:无法读取未定义的属性“原型”

在Object.exports.inherits(util.js:634:43)

在对象。 (C:\ A_LONG_PATH \ node_modules \ HTTP代理\ lib中\ HTTP代理\ index.js:105:17)

在Module._compile(module.js:460:26)

在Object.Module._extensions..js(module.js:478:10)

在Module.load(module.js:355:32)

在Function.Module._load(module.js:310:12)

在Module.require(module.js:365:17)

在require(module.js:384:17)

在对象。 (C:\ A_LONG_PATH \ node_modules \ HTTP代理\ lib中\ HTTP-的proxy.js:4:17)

在Module._compile(module.js:460:26)

处理完成退出代码1

这可能与使用的库有关,因为我更新了它们并重新安装了jquery。 我用浏览器同步阅读了一个错误,但实际上我不使用它。 无论如何,我安装了最新版本,但这并没有改变任何东西。 那里有什么问题?

编辑:

 { "name": "Website", "title": "Website for Something", "description": "", "version": "0.28.0", "homepage": "https://www.homepage.com", "author": { "name": "Devel Oper", "email": "devel.oper@home.com" }, "private": true, "main": "./server/server", "devDependencies": { "amdclean": "1.x", "chai": "~1.7.2", "express": "3.x", "grunt": "~0.4.1", "grunt-contrib-clean": "^0.6.0", "grunt-contrib-connect": "~0.3.0", "grunt-contrib-copy": "^0.7.0", "grunt-contrib-jasmine": "^0.8.2", "grunt-contrib-jshint": "~0.3.0", "grunt-contrib-requirejs": "~0.4.0", "grunt-contrib-uglify": "~0.3.2", "grunt-contrib-watch": "^0.6.1", "grunt-crontab": "^0.2.0", "grunt-cucumber": "~0.2.1", "grunt-express-server": "^0.5.1", "grunt-karma": "~0.6.1", "grunt-localhosts": "0.0.8", "grunt-nightwatch": "^0.4.6", "grunt-nightwatchjs": "^1.3.0", "grunt-plato": "~0.2.1", "grunt-template-jasmine-istanbul": "~0.2.4", "grunt-template-jasmine-requirejs": "^0.2.3", "grunt-text-replace": "^0.3.12", "http-proxy": "1.0.0", "karma-coverage": "~0.1.0", "uglify-js": "~2.2.0", "webdriverjs": "~0.7.9" }, "dependencies": { "body-parser": "^1.13.1", "cookie-parser": "^1.3.5", "cookie-session": "^1.1.0" } } 

现在它正在工作。 解决方法是删除http-proxy库:

 npm uninstall http-proxy 

然后我将这些行添加到我的package.json文件中:

 "dependencies": { "eventemitter3": "0.1.6", "http-proxy": "~1.6" } 

npm install一切工作。