0

我已经在我的 Windows 7 计算机上本地运行我的 NodeJs 应用程序,在0.8.18. 但是,当我将它推送到 Heroku 并尝试访问该 URL 时,会记录以下错误:

2013-04-27T19:34:14.073833+00:00 heroku[web.1]: Process exited with status 1
2013-04-27T19:34:59.340168+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=myapp.org fwd="108.212.64.90" dyno= connect= service= status=503 bytes=
2013-04-27T19:35:00.565119+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=myapp.org fwd="108.212.64.90" dyno= connect= service= status=503 bytes=
2013-04-27T19:44:23.916316+00:00 heroku[web.1]: Starting process with command `node myApp.js`
2013-04-27T19:44:24.424716+00:00 app[web.1]:
2013-04-27T19:44:24.425324+00:00 app[web.1]: /app/myApp.js:7
2013-04-27T19:44:24.425680+00:00 app[web.1]:    ;
2013-04-27T19:44:24.425725+00:00 app[web.1]:    ^
2013-04-27T19:44:24.429639+00:00 app[web.1]: SyntaxError: Unexpected token ;
2013-04-27T19:44:24.429639+00:00 app[web.1]:     at Module._compile (module.js:437:25)
2013-04-27T19:44:24.429639+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:467:10)
2013-04-27T19:44:24.429639+00:00 app[web.1]:     at Module.load (module.js:356:32)
2013-04-27T19:44:24.429639+00:00 app[web.1]:     at Function.Module._load (module.js:312:12)
2013-04-27T19:44:24.429639+00:00 app[web.1]:     at Module.runMain (module.js:492:10)
2013-04-27T19:44:24.429639+00:00 app[web.1]:     at process.startup.processNextTick.process._tickCallback (node.js:245:9)
2013-04-27T19:44:25.437926+00:00 heroku[web.1]: Process exited with status 1
2013-04-27T19:44:25.414435+00:00 heroku[web.1]: State changed from starting to crashed
2013-04-27T19:44:22.954367+00:00 heroku[web.1]: State changed from crashed to starting

我的 procfile 简单地写着:

web: node myApp.js

我的package.json阅读:

{
  "name": "Arbol",
  "version": "0.0.1",
  "dependencies": {
    "express": "3.1.0",
"bcrypt": "0.7.5",
"connect-flash": "0.1.0",
"sequelize":"1.4.1",
"ejs":"0.8.3",
"oath":"0.2.3",
"node-markdown":"0.1.1",
"pg":"0.15.1",
"passport":"0.1.16",
"passport-twitter":"0.1.4",
"passport-google":"0.3.0",
"passport-facebook":"0.1.5"
  },
  "engines": {
    "node": "0.8.x",
    "npm": "1.1.x"
  }
}

此外,这里是第一行myApp.js

console.log('neither here');
var express = require('express'),
app = module.exports = express(),
passport = require('passport'),
flash = require('connect-flash'),
FacebookStrategy = require('passport-facebook').Strategy,
TwitterStrategy = require('passport-twitter').Strategy,
GoogleStrategy = require('passport-google').Strategy;
console.log('nor there');

console.log部署到 Heroku 时不会记录任何消息。

似乎没有任何myApp.js内容导致此问题,而是由Module. 是什么Module.js?我在哪里可以找到它,为什么我的应用会导致它出现问题?

4

1 回答 1

1

我通过 package.json 更改以明确说明确切的节点版本,问题就消失了:

  "engines": {
     "node": "0.8.19",
   "npm": "1.1.x"
   }
于 2013-04-27T21:13:51.757 回答