Getting started with elixir package manager can be a bitch

Many stuff are not well documented. And just crappy to read through so much to do a simple package install. Hopefully this helps.

mix (installed together with your elixir) and hex is your package manager. All you need to do is create a new project using the following command (you're trying to do something like npm install)

a) mix new myProject - after that try running mix compile. You can see your project being compiled.

After you have done that, open a file called "mix.exs". This is your package.json file in node. Locate your "defp deps" as shown here and add in a dependencies for cowboy or whatever you like from here :-

This basically saying that you are trying to use external libraries.

Next run "mix deps.get"  - to download your package to a folder called dep. This is done automatically.

Great and you will see dep folder being filled up.

Fire up your iex (using the following command - iex -S mix) and run the following command to see if your dependencies are installed :-

Poison.encode!(%{"age" => 27, "name" => "Devin Torres"})
#=> "{\"name\":\"Devin Torres\",\"age\":27}"

If you have the output above, great! you're good to go.


Popular posts from this blog

ionic2 cordova build android - Unable resolve gradle 2.2.3

A quick tutorial for OWASP ZAP tool for beginners