Can't deploy Phoenix App to Heroku(invalid bin entry)

Hi All,

I’ve made a very small Phoenix LiveView app (no database, just a couple of live view pages), and for some reason deploying to Heroku is just not working out for me. It looks like an issue with node_modules, but the error isn’t making a whole lot of sense to me. I’ve deployed test apps to Heroku before and haven’t run into this issue. Followed along step by step with the deploying to Heroku page of the official phoenix docs, but still no luck. :frowning:

Here is where the error pops up on deployment.

remote: Generated presentr app
remote: -----> Creating .profile.d with env vars
remote: -----> Writing export for multi-buildpack support
remote: -----> Phoenix app detected
remote: 
remote: -----> Loading configuration and environment
remote:        Loading config...
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 10.19.0
remote:        Will export the following config vars:
remote: GITHUB_TOKEN
remote: SECRET_KEY_BASE
remote:        * MIX_ENV=prod
remote: 
remote: -----> Installing binaries
remote: Resolving node version 10.19.0...
remote: Downloading and installing node 10.19.0...
remote:        Installing Node 10.19.0...
remote:        Using default npm version 6.13.4
remote: 
remote: -----> Building dependencies
remote:        Installing node modules
remote: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules/fsevents):
remote: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
remote: 
remote: npm ERR! invalid bin entry for package @babel/parser@7.9.4. key=parser, value=bin/babel-parser.js
remote: 
remote: npm ERR! A complete log of this run can be found in:
remote: npm ERR!     /app/.npm/_logs/2020-04-27T13_49_25_423Z-debug.log
remote:  !     Push rejected, failed to compile Phoenix app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to still-headland-73103.
remote: 

Can post full logs, contents of any files, etc. if that would help.

Thanks!

seems like npm has this issue https://github.com/npm/cli/issues/613 - can you try using node 10.20.1 (which comes with a later npm version) ? pls confirm if it works and I’ll PR the phoenix docs/guide…

1 Like

AMAZING! Build Succeeded! Cannot thank you enough, as I NEVER would have thought that the node version I was specifying in the elixir Buildpack could’ve caused this.

Thanks again!

1 Like

:raised_hands: PR to fix the docs/guide - https://github.com/phoenixframework/phoenix/pull/3801

edit: fix is live… thx for reporting @steveryan https://hexdocs.pm/phoenix/heroku.html#adding-the-phoenix-server-and-assets-buildpack