Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get this error `(Mix) Could not find an SCM for dependency :cowboy `

I have a elixir project and below is the mix configuration file:

defmodule MyFirstApp.Mixfile do
  use Mix.Project

  def project do
    [
      app: :my_first_app,
      version: "0.1.0",
      elixir: "~> 1.5",
      start_permanent: Mix.env == :prod,
      deps: deps()
    ]
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      extra_applications: [:logger],
      mod: {MyFirstApp, []}
    ]
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      # {:dep_from_hexpm, "~> 0.3.0"},
      # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"},
      {:cowboy, "~> 1.1.2"},
      {:plug, "~> 1.3.4"},
      {:slime, "~> 0.14"}
    ]
  end
end

I got below error when I run mix deps.get on ubuntu:

mix deps.get
Could not find Hex, which is needed to build dependency :cowboy
Shall I install Hex? (if running non-interactively, use "mix local.hex --force") [Yn] ** (Mix) Could not find an SCM for dependency :cowboy from MyFirstApp.Mixfile
Exited with code 1

I don't understand why happens here. It seems that there is a missing dependency of Hex but how I can install Hex on my system?

like image 656
Joey Yi Zhao Avatar asked Feb 27 '18 05:02

Joey Yi Zhao


1 Answers

You should run mix local.hex on your shell. It will installs Hex locally.

Hex is package manager for the Erlang VM, currently provides tasks that integrate with Mix, Elixir's build tool.

like image 193
chris Avatar answered Nov 15 '22 08:11

chris