简体   繁体   English

mix.exs依赖项声明中的正确版本

[英]Correct version in mix.exs dependency declaration

I have a mix.exs file that has some dependencies: 我有一个具有某些依赖项的mix.exs文件:

def deps do
    [{:nadia, "~> 0.4"}]
end

Let's say I want to change Nadia to version 0.3 . 假设我想将Nadia更改为0.3版。 I'm having a hard time doing that. 我很难做到这一点。

After making the change to mix.exs , I can't get the version 0.3 for Nadia. mix.exs更改后,我无法获得Nadia的0.3版本。 Neither mix deps.update nor mix deps.unlock && mix deps.update help me. mix deps.updatemix deps.unlock && mix deps.update对我有帮助。

I'm sure there's a way to do this; 我敢肯定有办法做到这一点; I just couldn't find it. 我只是找不到。

Thanks in advance! 提前致谢!

The reason the requirement ~> 0.3 gives you 0.4.0 is because ~> 0.3 is equivalent to >= 0.3.0 and < 1.0.0 ( ref ). 要求~> 0.3给出0.4.0的原因是因为~> 0.3等于>= 0.3.0 and < 1.0.0ref )。 If you want >= 0.3.0 and < 0.4.0 , you need to use the requirement ~> 0.3.0 : 如果要>= 0.3.0 and < 0.4.0 ,则需要使用条件~> 0.3.0

def deps do
  [{:nadia, "~> 0.3.0"}]
end

A simple mix deps.get after changing your mix.exs will give you the latest 0.3.x version of nadia . 一个简单的mix deps.get更改后mix.exs会给你最新的0.3.x版本nadia There's no need to run mix deps.unlock or mix deps.update . 无需运行mix deps.unlockmix deps.update

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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