heroku create --stack cedar
create a .env
file in your application with this contents:
LD_PRELOAD='/app/node_modules/canvas/cairo/libcairo.so /app/node_modules/canvas/lib/libpixman-1.so.0 /app/node_modules/canvas/lib/libfreetype.so.6'
LD_LIBRARY_PATH=/app/node_modules/canvas/cairo
LD_PRELOAD
will tell heroku to always preload those libsLD_LIBRARY_PATH
will tell heroku where to find aditional dinamic libs
If the .env
file doesn't work for you, alternatively, you can try:
$ heroku config:add LD_PRELOAD='/app/node_modules/canvas/cairo/libcairo.so /app/node_modules/canvas/lib/libpixman-1.so.0 /app/node_modules/canvas/lib/libfreetype.so.6' --app your-app
$ heroku config:add LD_LIBRARY_PATH=/app/node_modules/canvas/cairo --app your-app
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.
=======