Does anybody have a working Heroku example they could share? I keep getting bitten by this libtinfo5 problem, and I can’t just sudo apt-get libtinfo5
to fix it. I’m currently just committing the pre-compiled JS bundles to my repository and removing purescript from my package.json dependencies, but I’d really love a better solution if someone knows how to get the purescript compiler working on Heroku.
Just in case anybody finds this old post searching discourse for “heroku,” PureScript 0.14.1 issued a fix for this problem. This weekend I updated to PureScript 0.14.2 and everything worked on Heroku with no hacks needed! You can just add PureScript & spago as dev dependencies, and Heroku can download PureScript, build, & bundle a program through the normal npm install
and npm run build
scripts.
Interesting, I have a project currently running on 0.13.8 that never gave me any issues. It’s private but I don’t do anything special - don’t even use a Procfile.
It’s probably because we switched to using the latest Ubuntu release for creating the prebuilt binaries when we switched over from Travis to GH Actions, in between the 0.14.0 and 0.14.1 releases. If you build on a newer version of Ubuntu than you deploy on, you’re likely to run into dynamic library incompatibilities. We switched that back so it’s less likely to be an issue as of 0.14.2.
You’re saying that purescript@0.13.8 is in your devDependencies in package.json, and you can run stuff like e.g., spago bundle-app
on heroku when deploying, and it all just worked okay? That’s weird because when I was running 0.13.8, I would definitely get that error about libtinfo stuff whenever heroku tried to run any spago commands. I wonder what the difference was?
yep
"scripts": {
...
"build": "gulp build && spago bundle-app -t public/chat.js",
}
"devDependencies": {
...
"spago": "^0.17.0",
"purescript": "^0.13.8"
}
We are also using NPM to deliver most of the executables to Heroku since the built-in Node buildpack has its own caching. The trickier part was adding a buildpack just to handle zephyr
since it’s not on NPM and doing your own buildpacks… well it’s probably easier to use Nix and make a derivation.
Locally I’m using Nix + my fork of easy-purescript-nix
(works with nixUnstable
) with the executables like purescript
in the package.json
's optionalDependencies
so I can skip downloading them locally. It may be nicer to use Nix + Cachix in the future, but a) it hasn’t been assessed be the team and b) using Nix removes any benefits of using Heroku.