Heroku buildpack: Node.js
$ ls Procfile package.json web.js $ heroku create --stack cedar --buildpack http://github.com/liquid/heroku-buildpack-nodejs.git $ git push heroku master ... -----> Heroku receiving push -----> Fetching custom buildpack -----> Node.js app detected -----> Vendoring node 0.6.6 -----> Installing dependencies with npm 1.1.0-alpha-6 firstname.lastname@example.org ./node_modules/express ├── email@example.com ├── firstname.lastname@example.org └── email@example.com Dependencies installed
The buildpack will detect your app as Node.js if it has the file
package.json in the root. It will use NPM to install your dependencies, and vendors a version of the Node.js runtime into your slug. The
node_modules directory will be cached between builds to allow for faster NPM install time.
You can create your own buildpack in order to use different versions of Node.js and/or NPM. To change the vendored binaries for Node.js, NPM, and SCons, use the helper scripts in the
You are going to need the following:
- An S3 enabled AWS account to store your binaries in.
- Your application must use NPM to manage dependencies. (See
package.jsonon the Heroku Dev Center).
- Obviously a Heroku user account. Signup is free and instant.
Fork this buildpack on Github and clone it to somewhere in order to make changes to it
Set the nexessary environment variables in your shell:
$ export AWS_ID="YOUR-AWS-ID" AWS_SECRET="YOUR-AWS-SECRET" S3_BUCKET="YOUR-S3BUCKET-NAME"
Create your S3 bucket (in case it doesn't exist yet):
$ s3 create $S3_BUCKET
Customise your version of Node that you want to use by running
./support/package_nodewith the desired version of Node. The script will compile Node and push the binaries ready onto your S3 bucket:
$ ./support/package_node 0.6.6
bin/compilein your editor, and change the following lines:
Commit and push the changes to your buildpack to your Github fork
Create a test application that makes use of your custom buildpack and push to it:
$ heroku create --buildpack <your-github-url>
You should see:
-----> Vendoring node 0.6.6 -----> Installing dependencies with npm 1.1.0-alpha-6