I do npm install -d, and then push all my stuff with git heroku push master. In my heroku logs, it would display:
2012-05-01T00:21:37+00:00 heroku[web.1]: Starting process with command `node app.js`
2012-05-01T00:21:39+00:00 app[web.1]:
2012-05-01T00:21:39+00:00 app[web.1]: node.js:201
2012-05-01T00:21:39+00:00 app[web.1]: ^
2012-05-01T00:21:39+00:00 app[web.1]: Error: Cannot find module 'mkdirp'
2012-05-01T00:21:39+00:00 app[web.1]: at Function._load (module.js:279:25)
2012-05-01T00:21:39+00:00 app[web.1]: at Module.require (module.js:354:17)
2012-05-01T00:21:39+00:00 app[web.1]: throw e; // process.nextTick error, or 'error' event on first tick
2012-05-01T00:21:39+00:00 app[web.1]: at Function._resolveFilename (module.js:332:11)
2012-05-01T00:21:39+00:00 app[web.1]: at require (module.js:370:17)
2012-05-01T00:21:39+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/stylus/lib/middleware.js:16:14)
2012-05-01T00:21:39+00:00 app[web.1]: at Module._compile (module.js:441:26)
2012-05-01T00:21:39+00:00 app[web.1]: at Object..js (module.js:459:10)
2012-05-01T00:21:39+00:00 app[web.1]: at Module.load (module.js:348:31)
2012-05-01T00:21:39+00:00 app[web.1]: at Function._load (module.js:308:12)
2012-05-01T00:21:39+00:00 app[web.1]: at Module.require (module.js:354:17)
2012-05-01T00:21:40+00:00 heroku[web.1]: Process exited with status 1
2012-05-01T00:21:40+00:00 heroku[web.1]: State changed from starting to crashed
Obviously, I have none of this problem when I deploy locally. I have the mkdirp module within my jade module, which is inside the node_modules of my application.
I also have the Procfile:
web: node app.js
Here is my package.json:
{
"name": "gemini"
, "version": "0.0.1"
, "contributors": [
{ "name": "****", "email": "****" }
]
, "private": true
, "engines": { "node": ">= 0.2.0" }
, "dependencies": {
"express": "2.5.1"
, "stylus": ">= 0.17.0"
, "jade": "0.3.0"
}
}
Can anyone please advise? Thanks!
Upon review of the error it's not related to Jade it's related to Stylus. It could come from the problem that Stylus is referencing an older version, although the use of >=
should mean it'll grab the latest version.
The Heroku push should list out what modules are detected as dependencies by Heroku and installed.
The version of Jade you're referencing is really quite old, the current version is 0.25.0; where you're using 0.3.0.
I've looked into that version and this is the package.json
contents:
{
"name": "jade",
"description": "Jade template engine",
"version": "0.3.0",
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"main": "./lib/jade.js",
"bin": { "jade": "./bin/jade" },
"engines": { "node": ">= 0.1.98" }
}
What you'll notice is that it isn't specifying that mkdirp is a dependency, but it may be requiring it (I didn't dig into the source).
I've successfully run Jade 0.25.0 on Heroku but never tried older versions than that.
I fixed it by doing npm install mkdirp and then pushing.
I get a warning though for missing mkdirp and defaulting to the one that I just installed. Probably because I know that I also definitely have mkdirp inside the node_modules of both jade and stylus?
In any case, the app is deployed now.