I've run my NodeJs app locally on my Windows 7 computer without any problem running on 0.8.18. However, when I push it to Heroku and try to visit the URL, the following error is logged:
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
My procfile simply reads:
web: node myApp.js
My package.json reads:
{
"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"
}
}
Additionally, here are the first lines of 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');
Neither of the console.log messages are logged when deployed to Heroku.
It seems that nothing in myApp.js is causing this issue, but rather it is being caused by Module. What is Module.js? Where can I find it and why would my app cause a problem in it?
I changed by package.json to explicitly state the exact node version and the problem went away:
"engines": {
"node": "0.8.19",
"npm": "1.1.x"
}