BEAM file compliation error after degrading Erlang version from 22 to 21

I have followed this StackOverflow post to install the specific version of Erlang.

And When I am running mix ecto.setup then getting following error-

Error loading module telemetry_handler_table:
  This BEAM file was compiled for a later version of the run-time system than 21.
  To fix this, please recompile this module with an 21 compiler.

When running iex command, following version I am getting-

Erlang/OTP 21 [erts-10.3.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Interactive Elixir (1.8.2)