Deploy Node.js Applications
This page will prepare you to deploy Node.js apps via the getting started guide.
Cloud Foundry expects a
package.json in your Node.js application. You can specify the version of Node.js you want to use in the
engine node of your
package.json file. As of July, 2013, Cloud Foundry uses 0.10.x as the default.
Node.js applications require a start command, which is saved with other configurations in
You will be asked if you want to save your configuration the first time you deploy. This will save a
manifest.yml in your application with the settings you entered during the initial push. Edit the
manifest.yml file and create a start command as follows:
--- applications: - name: my-app command: node my-app.js ... the rest of your settings ...
Alternately, specify the
cf push --command flag.
$ cf push --command "node my-app.js"
You do not need to run
npm install before deploying your application. Cloud Foundry will run it for you when your application is pushed. If you would prefer to run
npm install and create a
node_modules folder inside of your application, this is also supported.
If Cloud Foundry does not automatically detect that your application is a Node.js application, you can override the auto-detection by specifying the Node.js buildpack.
Either, add the buildpack into your
manifest.yml and re-run
cf push --reset
--- applications: - name: my-app buildpack: https://github.com/cloudfoundry/heroku-buildpack-nodejs.git ... the rest of your settings ...
Or, specify the
cf push --buildpack flag.
$ cf push --buildpack https://github.com/cloudfoundry/heroku-buildpack-nodejs.git
Refer to the instructions for node.js service bindings.