Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Node canvas is a Cairo backed Canvas implementation for NodeJS.

HEROKU Node Canvas


1. create a heroku app in cedar:

heroku create --stack cedar

2. set environment variables

create a .env file in your application with this contents:

LD_PRELOAD='/app/node_modules/canvas/cairo/ /app/node_modules/canvas/lib/ /app/node_modules/canvas/lib/'
  • LD_PRELOAD will tell heroku to always preload those libs
  • LD_LIBRARY_PATH will tell heroku where to find aditional dinamic libs

Note on #2:

If the .env file doesn't work for you, alternatively, you can try:

$ heroku config:add LD_PRELOAD='/app/node_modules/canvas/cairo/ /app/node_modules/canvas/lib/ /app/node_modules/canvas/lib/' --app your-app
$ heroku config:add LD_LIBRARY_PATH=/app/node_modules/canvas/cairo --app your-app

Final Notes

If you ever need to "re-install" a library like this on heroku, you'll need to either

  • Destroy and recreate the app on heroku
  • Or, up the version number in the package.json

Heroku won't re-install, it will only pull from cache, if the version number is the same.

Something went wrong with that request. Please try again.