Application metadata file exists but is malformed

I was playing around with Cowboy recently. I had followed the Getting Started guide, but was hoping to avoid having to get into releases. Sadly, the easiest way to serve static files is from an application priv_dir.

I created a relx.config file, but when I ran make I got a cryptic error:

===> Starting relx build process ...
===> Resolving OTP Applications from directories:
          /vagrant/ebin
          /vagrant/deps
          /usr/local/lib/erlang/lib
===> Application metadata file exists but is malformed: /vagrant/ebin/my_app.app
===> Resolving available OTP Releases from directories:
          /vagrant/ebin
          /vagrant/deps
          /usr/local/lib/erlang/lib
Failed to solve release:
 Dependency my_app is specified as a dependency but is not reachable by the system.

I was pretty sure my app metadata file wasn’t malformed, but a quick dig through the sauce led me back to an ominous warning in the cowboy docs:

the modules line will be replaced with the list of modules during compilation; make sure to leave this line even if you do not use it directly

Adding an empty modules list was enough to build a release successfully:

{application, my_app, [
    {description, "My App"},
    ...
    {modules, []},
    ...
]}.
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
          /vagrant/ebin
          /vagrant/deps
          /usr/local/lib/erlang/lib
===> Resolving available OTP Releases from directories:
          /vagrant/ebin
          /vagrant/deps
          /usr/local/lib/erlang/lib
===> Resolved my_app-1
===> Including Erts from /usr/local/lib/erlang
===> release successfully created!
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s