Deploying on Heroku a Elixir Phoenix project it is saying that mix command not found on command heroku run 'POOL_SIZE=2 mix test.task'
I pushed the code before running and followed the tutorial on elixir docs carefully.
To mention - mix phx.server and all other mix commands are workin just fine. Elixir version: 1.11.2
$ heroku run "POOL_SIZE=2 mix hello.task"
› Warning: heroku update available from 7.52.0 to 7.53.1.
Running POOL_SIZE=2 mix hello.task on ⬢ bgsites... up, run.4395 (Free)
bash: mix: command not found
$ heroku buildpacks:add https://github.com/gjaldon/heroku-buildpack-phoenix-static.git
› Warning: heroku update available from 7.52.0 to 7.53.1.
› Error: The buildpack
› https://github.com/gjaldon/heroku-buildpack-phoenix-static.git is already
› set on your app.
$ git push heroku main
Enumerating objects: 2346, done.
Counting objects: 100% (2346/2346), done.
Delta compression using up to 12 threads
Compressing objects: 100% (639/639), done.
Writing objects: 100% (2346/2346), 1.68 MiB | 477.00 KiB/s, done.
Total 2346 (delta 1633), reused 2309 (delta 1603), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: https://github.com/gjaldon/heroku-buildpack-phoenix-static.git
remote: -----> Phoenix app detected
remote:
remote: -----> Loading configuration and environment
remote: Loading config...
remote: The config file phoenix_static_buildpack.config wasn't found
remote: Using the default config provided from the Phoenix static buildpack
remote: Detecting assets directory
remote: WARNING: no package.json detected in root nor custom directory
remote: * assuming phoenix 1.3.x and later, please check config file
remote: Will use phoenix configuration:
remote: * assets path assets
remote: * mix tasks namespace phx
remote: Will use the following versions:
remote: * Node 6.9.2
remote: Will export the following config vars:
remote: DATABASE_URL
remote: POOL_SIZE
remote: SECRET_KEY_BASE
remote: * MIX_ENV=prod
remote:
remote: -----> Installing binaries
remote: Resolving node version 6.9.2...
remote: Downloading and installing node 6.9.2...
remote: Installing Node 6.9.2...
remote: Using default npm version 3.10.9
remote: Downloading and installing yarn 0.27.5...
remote: Installed yarn 0.27.5
remote:
remote: -----> Building dependencies
remote: Installing node modules
remote: yarn install v0.27.5
remote: [1/4] Resolving packages...
remote: error "/tmp/build_9c2e4576/deps/phoenix" doesn't exist.
remote: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
remote: ! Push rejected, failed to compile Phoenix app.
remote:
remote: ! Push failed
remote: !
remote: ! ## Warning - The same version of this code has already been built: 9c969d85d1fdd442d194e89b429009060345e431
remote: !
remote: ! We have detected that you have triggered a build from source code with version 9c969d85d1fdd442d194e89b429009060345e431
remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote: !
remote: ! If you are developing on a branch and deploying via git you must run:
remote: !
remote: ! git push heroku <branchname>:main
remote: !
remote: ! This article goes into details on the behavior:
remote: ! https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to bgsites.
remote:
To https://git.heroku.com/bgsites.git
! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/bgsites.git'
From this I see that remote: error "/tmp/build_9c2e4576/deps/phoenix" doesn't exist.
$ heroku buildpacks:clear
› Warning: heroku update available from 7.52.0 to 7.53.1.
Buildpacks cleared. Next release on bgsites will detect buildpacks normally.
$ heroku buildpacks:set hashnuke/elixir
› Warning: heroku update available from 7.52.0 to 7.53.1.
Buildpack set. Next release on bgsites will use hashnuke/elixir.
heroku buildpacks:add https://github.com/gjaldon/heroku-buildpack-phoenix-static.git
› Warning: heroku update available from 7.52.0 to 7.53.1.
Buildpack added. Next release on bgsites will use:
1. hashnuke/elixir
2. https://github.com/gjaldon/heroku-buildpack-phoenix-static.git
Run git push heroku main to create a new release using these buildpacks.
Do you have elixir_buildpack.config in your app directory specifying the erlang and elixir version. Create phoenix_static_buildpack.config for the other buildpack
Its like this:
# Elixir version
elixir_version=1.11.2
# Erlang version
erlang_version=23.2