Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
&引用;您的Ruby版本是2.4.2,但您的Gemfile指定了2.5.0--为什么?_Ruby_Heroku - Fatal编程技术网

&引用;您的Ruby版本是2.4.2,但您的Gemfile指定了2.5.0--为什么?

&引用;您的Ruby版本是2.4.2,但您的Gemfile指定了2.5.0--为什么?,ruby,heroku,Ruby,Heroku,在my.ruby版本和GEM文件中,指定了ruby2.5.0。当我运行“ruby-v”时,我得到了“2.5.0”。但是,在部署到Heroku时,出现以下错误: Your Ruby version is 2.4.2, but your Gemfile specified 2.5.0 为什么??如何修复它?根据以下原因解决此问题 您的bundler版本可能很旧 您可能在Gemfile和Gemfile.lock 如果ruby-v正在输出2.5.0,您可能需要更新Gemfile.lock。最好

在my.ruby版本和GEM文件中,指定了ruby
2.5.0
。当我运行“ruby-v”时,我得到了“2.5.0”。但是,在部署到Heroku时,出现以下错误:

    Your Ruby version is 2.4.2, but your Gemfile specified 2.5.0
为什么??如何修复它?

根据以下原因解决此问题

  • 您的bundler版本可能很旧
  • 您可能在
    Gemfile
    Gemfile.lock

  • 如果
    ruby-v
    正在输出
    2.5.0
    ,您可能需要更新
    Gemfile.lock
    。最好的方法是使用bundler

    检查项目根目录中的
    Gemfile.lock
    文件,查看它引用的Ruby版本。它可能会说
    ruby 2.4.2


    运行
    bundle update
    bundle install
    应使您的
    Gemfile
    Gemfile.lock
    再次匹配。

    首先更新安装在PC/笔记本电脑中的Ruby版本(如果有)

    删除写入gemfile中的ruby“[版本号]”

    只需将该版本调整到电脑中安装的升级版本即可。。可能重复的其他副本