Error: 'C.UTF-8' is not a supported language or locale
Following the blogpost Deploying an Elixir app to Digital Ocean with mix_deploy, I run into the following error on the step: sudo bin/build-install-deps-ubuntu
===> Installing locale C.UTF-8
Error: 'C.UTF-8' is not a supported language or locale
I had to:
sudo vim /etc/default/locale
Then paste the following:
LANGUAGE="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
Save the file. Logout and login again.
C.UTF-8 ended up not being well supported, so I switched to en_US.UTF-8 (or en_US.utf8) in my latest scripts. I think this should have already been fixed.... can you make sure you are running the latest code and see if it still occurs?
Yeah I tried again and this still occurs, now this time I used Ubuntu 20.04 (LTS) x64, could that cause the issue? Strange because bin/build-install-deps-ubuntu indeed has:
# Make sure we have a good LANG
export LANG="${LANG:-en_US.UTF-8}"
The issue is that your OS install does not have the locale defined. I guess it's super minimal. That's why I was trying to use C.UTF-8, but even that name is not consistent between Linux distros.
You can define the en_US.UTF-8 locale with something like:
sudo localedef -i en_US -f UTF-8 en_US.UTF-8
Or maybe
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8