Heroku Deploy Issues with Phoenix 1.3

I have a fresh install of Phoenix 1.3 and working on a new project. I’ve followed the instructions on the Phoenix site for deploying to Heroku http://www.phoenixframework.org/docs/heroku . However, I’m getting an error when trying to push. I’m suspecting the path of ../deps/phoenix and have tried a couple of different options such as deps/phoenix but nothing is solving the issue.

Console
Simons-MBP:dmt Simon$ git push heroku master
Counting objects: 155, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (136/136), done.
Writing objects: 100% (155/155), 58.46 KiB | 0 bytes/s, done.
Total 155 (delta 43), reused 0 (delta 0)
remote: Compressing source files… done.
remote: Building source:
remote:
remote: -----> Phoenix app detected
remote:
remote: -----> Loading configuration and environment
remote: Loading config…
remote: WARNING: phoenix_static_buildpack.config wasn’t found in the app
remote: Using default config from 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: Downloading node 6.9.2…
remote: Installing Node 6.9.2…
remote: Using default npm version
remote:
remote: -----> Building dependencies
remote: Installing and caching node modules
remote: npm WARN package.json @ No description
remote: npm WARN package.json @ No README data
remote: npm ERR! addLocal Could not install /tmp/deps/phoenix
remote: npm ERR! addLocal Could not install /tmp/deps/phoenix_html
remote: npm ERR! Linux 3.13.0-112-generic
remote: npm ERR! argv “/tmp/build_39c31bc1b95fb93fa0e609c296a4e0f0/.heroku/node/bin/node” “/tmp/build_39c31bc1b95fb93fa0e609c296a4e0f0/.heroku/node/bin/npm” “install” “–quiet” “–unsafe-perm” “–userconfig” “/tmp/build_39c31bc1b95fb93fa0e609c296a4e0f0/npmrc”
remote: npm ERR! node v6.9.2
remote: npm ERR! npm v3.10.9
remote: npm ERR! path /tmp/deps/phoenix
remote: npm ERR! code ENOENT
remote: npm ERR! errno -2
remote: npm ERR! syscall open
remote:
remote: npm ERR! enoent ENOENT: no such file or directory, open ‘/tmp/deps/phoenix’
remote: npm ERR! enoent ENOENT: no such file or directory, open ‘/tmp/deps/phoenix’
remote: npm ERR! enoent This is most likely not a problem with npm itself
remote: npm ERR! enoent and is related to npm not being able to find a file.
remote: npm ERR! enoent
remote:
remote: npm ERR! Please include the following file with any support request:
remote: npm ERR! /tmp/build_39c31bc1b95fb93fa0e609c296a4e0f0/assets/npm-debug.log
remote: ! Push rejected, failed to compile Phoenix app.
remote:
remote: ! Push failed
remote: Verifying deploy…
remote:
remote: ! Push rejected to digitalmoney.

package.json
{
“repository”: {},
“license”: “MIT”,
“scripts”: {
“deploy”: “brunch build --production”,
“watch”: “brunch watch --stdin”
},
“dependencies”: {
“phoenix”: “file:…/deps/phoenix”,
“phoenix_html”: “file:…/deps/phoenix_html”
},
“devDependencies”: {
“babel-brunch”: “6.0.6”,
“brunch”: “2.10.7”,
“clean-css-brunch”: “2.10.0”,
“uglify-js-brunch”: “2.1.1”
}
}

Have you added

assets_path=assets
phoenix_ex=phx

to your phoenix_static_buildpack.config file?

1 Like

I have just created the file and added those two rows. Alas no joy. Exact same error.

As I’ve just created the file, should it contain anything else, and why do I need it?

1 Like

Well, it’s actually needed for 2 reasons

  1. assets_path is needed because new npm install must run inside the assets path and not your application root
  2. phoenix_ex is needed because mix phoenix.digest was renamed to mix pix.digest

Just one question, is it an umbrella project?

PS.: Do you have the new log after adding phoenix_static_buildpack.config file?

After adding phoenix_static_buildback.config:
Simons-MBP:dmt Simon$ git push heroku master
Counting objects: 158, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (138/138), done.
Writing objects: 100% (158/158), 58.76 KiB | 0 bytes/s, done.
Total 158 (delta 44), reused 0 (delta 0)
remote: Compressing source files… done.
remote: Building source:
remote:
remote: -----> Phoenix app detected
remote:
remote: -----> Loading configuration and environment
remote: Loading config…
remote: WARNING: phoenix_static_buildpack.config wasn’t found in the app
remote: Using default config from 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: Downloading node 6.9.2…
remote: Installing Node 6.9.2…
remote: Using default npm version
remote:
remote: -----> Building dependencies
remote: Installing and caching node modules
remote: npm WARN package.json @ No description
remote: npm WARN package.json @ No README data
remote: npm ERR! addLocal Could not install /tmp/build_fab7d167b6bbf648749873cbb5588225/deps/phoenix
remote: npm ERR! addLocal Could not install /tmp/build_fab7d167b6bbf648749873cbb5588225/deps/phoenix_html
remote: npm ERR! Linux 3.13.0-112-generic
remote: npm ERR! argv “/tmp/build_fab7d167b6bbf648749873cbb5588225/.heroku/node/bin/node” “/tmp/build_fab7d167b6bbf648749873cbb5588225/.heroku/node/bin/npm” “install” “–quiet” “–unsafe-perm” “–userconfig” “/tmp/build_fab7d167b6bbf648749873cbb5588225/npmrc”
remote: npm ERR! node v6.9.2
remote: npm ERR! npm v3.10.9
remote: npm ERR! path /tmp/build_fab7d167b6bbf648749873cbb5588225/deps/phoenix
remote: npm ERR! code ENOENT
remote: npm ERR! errno -2
remote: npm ERR! syscall open
remote:
remote: npm ERR! enoent ENOENT: no such file or directory, open ‘/tmp/build_fab7d167b6bbf648749873cbb5588225/deps/phoenix’
remote: npm ERR! enoent ENOENT: no such file or directory, open ‘/tmp/build_fab7d167b6bbf648749873cbb5588225/deps/phoenix’
remote: npm ERR! enoent This is most likely not a problem with npm itself
remote: npm ERR! enoent and is related to npm not being able to find a file.
remote: npm ERR! enoent
remote:
remote: npm ERR! Please include the following file with any support request:
remote: npm ERR! /tmp/build_fab7d167b6bbf648749873cbb5588225/assets/npm-debug.log
remote: ! Push rejected, failed to compile Phoenix app.
remote:
remote: ! Push failed
remote: Verifying deploy…
remote:
remote: ! Push rejected to digitalmoney.

So as to npm install now in assets path, would this explain why when I tried to install a css package, it did not appear in node_modules?

And I don’t believe it’s an Umbrella app. Not entirely 100% what that is actually?

Yep, now package.json is inside assets, as well as your node_modules.

Can you try changing the above code to:

"dependencies": {
  "phoenix": "file:../../deps/phoenix",
  "phoenix_html": "file:../../deps/phoenix_html"
}

In your package.json? Seems like it’s searching for deps/phoenix inside the tmp folder.

Yeah I’d spotted that and have previously tried it, but beam throws the warning:

ENOENT: no such file or directory, open '/Users/Simon/Sites/deps/phoenix' I can’t get it to find the project root.

As in the root would be '/Users/Simon/Sites/dmt/deps/phoenix'

I’m missing mix deps.get in the log, it has to be done strictly before npm/brunch that they can find modules which are bonly in the phoenix package but not in npms registry.

you may have a typo phoenix_static_buildback.config vs phoenix_static_buildpack.config. Anyway, I believe newer versions of that build pack handle Phoenix v1.3 structure without more configurations. Check out hexpm/assets at main · hexpm/hexpm · GitHub for an example Phoenix v1.3 project that is deployed to Heroku; perhaps by comparing that project to your’s you’ll find what’s missing or misconfigured.

Yeah had a typo in this post not the app.

I’ve just installed a new app which worked fine so going to close this.

The solution to this on my system was to change the order of the buildpacks.
Unless https://github.com/HashNuke/heroku-buildpack-elixir.git is FIRST bad things seem to happen like those in the thread above.

To move them around. use:

  heroku buildpacks:remove URL 
  heroku buildpacks:add URL 

For example

 $ heroku buildpacks
=== my_app_name Buildpack URLs
1. https://github.com/HashNuke/heroku-buildpack-elixir.git
2. https://github.com/gjaldon/phoenix-static-buildpack

This actually helped me with deploying Phoenix 1.6 to Dokku. Thanks!

1 Like