简体   繁体   中英

How do I point to a local elixir version in mix.exs file?

So I have a phoenix project I'm using as a test app of sorts. If I want to use a local version of elixir source code that I'm using (and making changes on), how do I tell phoenix to use it? I also want to be able to use "iex -S mix" with it. The below elixir: ["~> 1.6.0-dev", path: '/my/local/path/to/elixir'] does not work, but it's what I'm trying to do.

I already tried adding the below and I get a syntax error. Adding elixir to the dependencies (in the def deps function) didn't seem to do anything. I'm also using kiex and kerl for elixir version configuration.

defmodule PhoenixTestApp.Mixfile do
  use Mix.Project

  def project do
    [
      app: :phoenix_testbed,
      version: "0.0.1",
      elixir: ["~> 1.6.0-dev", path: '/my/local/path/to/elixir']
      elixirc_paths: elixirc_paths(Mix.env),
      compilers: [:phoenix, :gettext] ++ Mix.compilers,
      start_permanent: Mix.env == :prod,
      aliases: aliases(),
      deps: deps()
    ]
  end
  ## some more default config code generated by Phoenix
  # :
  # :
end

You need use the local elixir binary.

For example, instead of iex -S mix phx.server , do $YOUR_LOCAL_ELIXIR_PATH/bin/iex -S mix phx.server . Other stuff like mix , elixir are the same.

Your project is being run by elixir / iex already, so there is a chicken-egg problem trying to set an elixir / iex version from inside mix.exs file.

It's more the property of the operating system, rather than the project, to select an environment. There are many different elixir / erlang version managers out in the wild. I would name (amongst others);

I personally use the latter and I am happy with it. It allows setting a local version per project (with local .exenv file,) a global version, and the easy switch between different versions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM