Skip to content

heroku/buildpacks-nodejs

Heroku Cloud Native Buildpacks: Node.js

Cloud Native Buildpacks Registry: heroku/nodejs CI on Github Actions: heroku/nodejs

Heroku Cloud Native Buildpack: heroku/nodejs

This repository is the home of Heroku Cloud Native Buildpacks for Node.js applications. These buildpacks build Node.js application source code into application images with minimal configuration.

Important

This is a collection of Cloud Native Buildpacks, and is a component of the Heroku Cloud Native Buildpacks project, which is in preview. If you are instead looking for the Heroku Classic Buildpack for Node.js (for use on the Heroku platform), you may find it here.

Usage

Note

Before getting started, ensure you have the pack CLI installed. Installation instructions are available here.

To build a Node.js application codebase into a production image:

$ cd ~/workdir/sample-nodejs-app
$ pack build sample-app --builder heroku/builder:24

Then run the image:

docker run --rm -it -e "PORT=8080" -p 8080:8080 sample-app

Application Requirements

The heroku/nodejs buildpack requires a valid package.json to be present to build.

In order to install dependencies, a valid npm, yarn, or pnpm lockfile must be present.

Configuration

Node.js Version

To select a Node.js version, specify it via engines.node in package.json.

For example, to select the latest release of Node.js version 22, modify your package.json like this:

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

This field supports the same semantic versioning syntax as package.json.

If no Node.js version is specified, the latest LTS version will be used. We highly suggest specifying a version to prevent surprise changes.

Contributing

Issues and pull requests are welcome. See our contributing guidelines if you would like to help.

About

Heroku's Cloud Native Buildpacks for Node.js applications.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors 20