Phoenix not working - ERROR in ./js/app.js Module build failed

So i have Ubuntu as a system but you have Mac so you will probably use brew to install things.

Read the Important section a the end before starting following this guide

So let’s get started:

Head down here first:

Choose one of the two:

Using git(Recommended way)

git clone https://github.com/asdf-vm/asdf.git ~/.asdf
cd ~/.asdf
git checkout "$(git describe --abbrev=0 --tags)"

This is using brew

brew install asdf  - install asdf on Mac
brew install asdf --HEAD install asdf on Mac form the master repo with latest changes and fixes

Now if you use git do the following

Add to your Shell

echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bash_profile
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile

I personally use zsh with antigen (you can read more here Kubuntu against my old Bodhi Linux)
For zsh

echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zprofile

For brew install use this

Add to shell

echo -e "\n. $(brew --prefix asdf)/asdf.sh" >> ~/.bash_profile
echo -e "\n. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash" >> ~/.bash_profile

For zsh

Find asdf.sh and add to zsh

Following this command but locating the file

echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zprofile

Now to be able to install plugins add the following deps via homebrew or spack
Brew

brew install \
  coreutils automake autoconf openssl \
  libyaml readline libxslt libtool unixodbc \
  unzip curl

Spack

spack install \
  coreutils automake autoconf openssl \
  libyaml readline libxslt libtool unixodbc \
  unzip curl

Verify that asdf is a known command to your shell by typing asdf

Now we are ready to add the plugins:

Here are all the plugins available: asdf | asdf

We will use the Erlang plugin the Elixir plugin

Erlang

So head down to: GitHub - asdf-vm/asdf-erlang: Erlang plugin for asdf version manager

Before installing the Erlang plugin

OSX

These packages you have to install in order for the Erlang plugin to compile:

Install the build tools brew install autoconf

For building with wxWidgets (start observer or debugger!) brew install wxmac

Dealing with OpenSSL issues on macOS

You may encounter an SSL error with an output along these lines:

crypto : No usable OpenSSL found
ssh : No usable OpenSSL found
ssl : No usable OpenSSL found

This issue has been documented on kerl . If you see this error, you can use the --with-ssl flag with a path (in this case, the path is 1.0.2p , you should verify the correct path) before installing Erlang. Here is an example that skips the java depency and also sets a specific (and existing) path for OpenSSL on macOS.

$ export KERL_CONFIGURE_OPTIONS="--without-javac --with-ssl=/usr/local/Cellar/openssl/1.0.2p"
$ asdf install erlang <version>

Now we are ready for the actual install

So use the following command:

asdf install erlang ref:master

Give it time to compile, you can even go drink a coffee, because it will take some time to do this.

After it is done

Let’s get elixir:

head down here:

then use this command:

asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git

After elixir is installed you can install phoenix normally and it should all work

Here is the guide: Installation — Phoenix v1.7.10

  • So first install hex: mix local.hex if you already have it it will upgrade it to the latest version
  • Then mix archive.install hex phx_new 1.4.11 and yopu should be able now to use phoenix without worries.

!! Important

I wrote this guide without having access to a Mac OS so if there are any mistakes please correct them

I hope this will help you and others, that have issues with phoenix installation

2 Likes