-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
Elixir and Erlang/OTP versions
Elixir v 1.17.2
Erlang/OTP 27
Operating system
Mac OS 15.0.1
Current behavior
Hey 👋
as always, thanks for all the great work, that's a pleasure working in Elixir.
That's really a minor issue, but I spent few minutes on it, and therefore I wanted to share it.
First. When a dependency is not found in hex.pm, maybe because misspelled, mix deps.get returns an error with an hint. For example:
❯ mix deps.get
Failed to fetch record for plugxxxxx from registry (using cache instead)
This could be because the package does not exist, it was spelled incorrectly or you don't have permissions to it
** (Mix) No package with name plugxxxxx (from: mix.exs) in registry
While, the same does not happen when a local dependency specified with the option path is not found.
For instance, if this is my mix.exs
defmodule Hello.MixProject do
use Mix.Project
def project do
[
app: :hello,
version: "0.1.0",
elixir: "~> 1.17",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[extra_applications: [:logger]]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
# Refer to a local dependency that is missing
{:other_package, path: "other_package"}
]
end
endRunning mix deps.get just succeed without any error or warning, actually without printing anything in this case that it is the only dep.
Expected behavior
I'd expect a consistent behaviour across the different way to install a dependency.
mix deps.get should error when the specified path is not pointing to any folder in the local file system, or to a folder that is not an elixir library.
Maybe here, it would be enough to check if there is a mix.exs file within the specified path, otherwise raise an error. If you think it is a good idea, I'm happy to open a PR.
elixir/lib/mix/lib/mix/scm/path.ex
Line 24 in 860f485
| Keyword.put(opts, :dest, Path.expand(raw)) |
Thank you 😊