Giter Club home page Giter Club logo

heroku-buildpack-nodejs's Introduction

Heroku Buildpack for Node.js

This is the official Heroku buildpack for Node.js apps. If you fork this repository, please update this README to explain what your fork does and why it's special.

How it Works

Here's an overview of what this buildpack does:

  • Uses the semver.io webservice to find the latest version of node that satisfies the engines.node semver range in your package.json.
  • Allows any recent version of node to be used, including pre-release versions.
  • Uses an S3 caching proxy of nodejs.org for faster downloads of the node binary.
  • Discourages use of dangerous semver ranges like * and >0.10.
  • Uses the version of npm that comes bundled with node.
  • Puts node and npm on the PATH so they can be executed with heroku run.
  • Caches the node_modules directory across builds for fast deploys.
  • Doesn't use the cache if node_modules is checked into version control.
  • Runs npm rebuild if node_modules is checked into version control.
  • Always runs npm install to ensure npm script hooks are executed.
  • Always runs npm prune after restoring cached modules to ensure cleanup of unused dependencies.

For more technical details, see the heavily-commented compile script.

Documentation

For more information about using Node.js and buildpacks on Heroku, see these Dev Center articles:

Legacy Compatibility

For most Node.js apps this buildpack should work just fine. If, however, you're unable to deploy using this new version of the buildpack, you can get your app working again by using the legacy branch:

heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs#legacy -a my-app
git commit -am "empty" --allow-empty # force a git commit
git push heroku master

Then please open a support ticket at help.heroku.com so we can diagnose and get your app running on the default buildpack.

Hacking

To make changes to this buildpack, fork it on Github. Push up changes to your fork, then create a new Heroku app to test it, or configure an existing app to use your buildpack:

# Create a new Heroku app that uses your buildpack
heroku create --buildpack <your-github-url>

# Configure an existing Heroku app to use your buildpack
heroku config:set BUILDPACK_URL=<your-github-url>

# You can also use a git branch!
heroku config:set BUILDPACK_URL=<your-github-url>#your-branch

Testing

Anvil is a generic build server for Heroku.

gem install anvil-cli

The heroku-anvil CLI plugin is a wrapper for anvil.

heroku plugins:install https://github.com/ddollar/heroku-anvil

The ddollar/test buildpack runs bin/test on your app/buildpack.

heroku build -b ddollar/test # -b can also point to a local directory

For more info on testing, see Best Practices for Testing Buildpacks on the Heroku discussion forum.

heroku-buildpack-nodejs's People

Contributors

btubbs avatar cleishm avatar davidjrice avatar ddollar avatar dzuelke avatar hone avatar jacobwgillespie avatar jclem avatar lackac avatar mmcgrana avatar rwonly avatar ryanbrainard avatar rykov avatar timshadel avatar zbuc avatar zeke avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.