Bhanwarlal Chaudhary
Bhanwarlal Chaudhary

Reputation: 452

Elixir `mix` command throws error `could not call Module.put_attribute/3 because the module Helloworld.MixProject is already compiled`

Setup new project with command mix new project_name it setup everything without any error or warning message, cd to project and ran command iex -S mix it throws error

enter image description here

lib/helloworld.ex

defmodule Helloworld do
  @moduledoc """
  Documentation for `Helloworld`.
  """

  @doc """
  Hello world.

  ## Examples

      iex> Helloworld.hello()
      :world

  """
  def hello do
    :world
  end
end

Version installed on system

MacBook Pro M2 - OS 13.4.1
Terminal - Rosetta
OpenSSL 3.1.2 1 Aug 2023 (Library: OpenSSL 3.1.2 1 Aug 2023)
Erlang/OTP 26 [erts-14.0.2] [source] [64-bit
Elixir 1.15.4 (compiled with Erlang/OTP 26)
Mix 1.15.4 (compiled with Erlang/OTP 26)
Node v18.15.0
NPM 9.5.0

Upvotes: 3

Views: 695

Answers (2)

Bhanwarlal Chaudhary
Bhanwarlal Chaudhary

Reputation: 452

I was trying to install elixir on Rosetta terminal, and after switching to native terminal, was getting same error, so uninstalled everything related to elixir from Rosetta terminal, and on native terminal installed homebrew and followed https://elixir-lang.org/install.html#macos

Make sure all required dependencies must be installed with same homebrew

Upvotes: 1

tam ly nhat
tam ly nhat

Reputation: 29

I think you can follow this instruction to install elixir for MacOS: https://elixir-lang.org/install.html#macos

Upvotes: -1

Related Questions