I have a node.js app which I've just deployed to Heroku which depends upon the canvas module. However, that module requires the cairo graphics library and long story short, I need to use a precomipiled version which is included with this fork of canvas.
Normally, my package.json dependencies look like:
"dependencies" : {
"canvas" : "0.10.0",
"express" : "2.5.6",
"jade" : "0.20.1"
}
But in order to get my app to work on Heroku, I must pull in the fork from github
"dependencies" : {
"canvas" : "git://github.com/elspoono/node-canvas-heroku.git#master",
"express" : "2.5.6",
"jade" : "0.20.1"
}
Is it possible to have a "Heroku-only" version of package.json? Or is there another section in package.json where I can "override" the canvas dependency in dev environments?
Never used Heroku but package.json format defines the devDependencies field, see Nodejitsu cheatsheet. Then install with $ npm install -d
.
There's a tool called penv that looks promising. From their site:
Sometimes we need a different package.json properties for our different environments like production, staging and development. (Ex: jitsu deploys)
With penv you can customize your package.json file with properties defined inside an environments.json file.
Actually going to try it out now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With