Expressjs不加载在heroku样式表,给500错误

我正在heroku上运行一个Expressjs安装,而不是加载样式表

我点击ctrl + u,然后点击样式表链接,并得到这个错误:

TypeError: Object #<SendStream> has no method 'on' at Object.static [as handle] (/app/node_modules/express/node_modules/connect/lib/middleware/static.js:75:8) at next (/app/node_modules/express/node_modules/connect/lib/proto.js:190:15) 

当我去的url'/stylesheets/style.css'我得到这个错误:

 Express 500 TypeError: Object #<SendStream> has no method 'on' at Object.static [as handle] (/app/node_modules/express/node_modules/connect/lib/middleware/static.js:75:8) at next (/app/node_modules/express/node_modules/connect/lib/proto.js:190:15) at /app/node_modules/stylus/lib/middleware.js:174:46 at /app/node_modules/stylus/lib/middleware.js:208:20 

一切工作正常本地。

这里是package.json

  { "name": "app-name", "version": "0.0.1", "private": true, "scripts": { "start": "node app" }, "dependencies": { "express": "3.0.0rc1", "jade": "*", "stylus": "*" } } 

app.js:

 /** * Module dependencies. */ var express = require('express') , routes = require('./routes') , http = require('http') , path = require('path'); var app = express(); app.configure(function(){ app.set('port', process.env.PORT || 3000); app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(app.router); app.use(require('stylus').middleware(__dirname + '/public')); app.use(express.static(path.join(__dirname, 'public'))); }); app.configure('development', function(){ app.use(express.errorHandler()); }); app.get('/', routes.index); app.get('/about', routes.about); http.createServer(app).listen(app.get('port'), function(){ console.log("Express server listening on port " + app.get('port')); }); 

Procfile:

 web: node app.js 

如果我保持清爽,它会崩溃的应用程序。

       

网上收集的解决方案 "Expressjs不加载在heroku样式表,给500错误"

我能够通过在package.json中指定引擎相关性来解决这个问题

 { "name": "app-name", "version": "0.0.1", "private": true, "scripts": { "start": "node app" }, "dependencies": { "express": "3.0.0rc1", "jade": "*", "stylus": "*" }, "engines": { "node": "0.8.4", "npm": "1.1.41" } } 

我find了答案!你得到了一个错误的应用程序推送云的运行时间,你可以做到这一点

 vmc push yourappname --runtime node08 

我希望我能帮助你

我只是有同样的问题,发现运行以下命令(通过Heroku的CLI)为我工作:

herokuconfiguration:添加NODE_ENV =生产

这与Silas提到的指定Node和NPM的版本是一致的。

(通过http://quickleft.com/blog/getting-started-with-express-in-node