LATEST VERSION: 1.9 - CHANGELOG
Pivotal Cloud Foundry v1.9

Node.js Buildpack

Page last updated:

Push Node.js Apps

Cloud Foundry automatically uses the Node.js buildpack if it detects a package.json file in the root directory of your project.

If your Cloud Foundry deployment does not have the Node.js buildpack installed or the installed version is out of date, you can use the latest version by specifying it with the -b option when pushing your application. For example: bash cf push my_app -b https://github.com/cloudfoundry/buildpack-nodejs.git

For more detailed information about deploying Node.js apps, see the following topics:

You can find the source for the buildpack on GitHub: https://github.com/cloudfoundry/heroku-buildpack-nodejs

Supported Versions

Supported Node versions can be found in the release notes.

Specify a Node.js Version

Set engines.node in package.json to the semver range or the specific version of node you are using:

"engines": {
  "node": "6.9.x"
}

or

"engines": {
  "node": "6.9.0"
}

If you try to use a version that is not currently supported, staging your app fails with the following error message:

$   Could not get translated url, exited with: DEPENDENCY_MISSING_IN_MANIFEST:...
$   !
$   !     exit
$   !
$   Staging failed: Buildpack compilation step failed

Specify an npm Version

Set engines.npm in package.json to the semver range or specific version of npm you are using:

"engines": {
  "node": "6.9.x",
  "npm": "2.15.x"
}

or

"engines": {
  "node": "6.9.0",
  "npm": "2.15.1"
}

If you do not specify an npm version, your app uses the default npm packaged with your app’s Node.js version.

If your environment cannot connect to the Internet and you specified a non-supported version of npm, the buildpack fails to download npm and you see the following error message:

$   We're unable to download the version of npm you've provided (...).
$   Please remove the npm version specification in package.json (...)
$   Staging failed: Buildpack compilation step failed

Vendor App Dependencies

In order to vendor dependencies for an app using the Node.js buildpack, use npm:

$ cd APP-DIR
$ npm install # vendors into APP-DIR/node_modules

The cf push command uploads the vendored dependencies with the app.

Note: For an app to run in a disconnected environment, it must vendor its dependencies. For more information, see Disconnected environments.

OpenSSL Support

The nodejs-buildpack packages binaries of Node.js with OpenSSL that are statically linked. The Node.js buildpack supports Node.js 4.x and greater, which relies on the Node.js release cycle to provide OpenSSL updates. The binary-builder enables static OpenSSL compilation.

Proxy Support

If you need to use a proxy to download dependencies during staging, you can set the http_proxy and/or https_proxy environment variables. For more information, see the Proxy Usage Docs.

BOSH Configured Custom Trusted Certificate Support

Nodejs hardcodes root CA certs in its source code. To use BOSH configured custom trusted certificates, a developer must pass the specified CAs to the tls.connect function as extra arguments.

Help and Support

Join the #buildpacks channel in our Slack community if you need any further assistance.

For more information about using and extending the Node.js buildpack in Cloud Foundry, see the nodejs-buildpack GitHub repo.

You can find current information about this buildpack on the Node.js buildpack release page in GitHub.

Was this helpful?
What can we do to improve?
View the source for this page in GitHub