2012-03-01 29 views
0

我们使用capistrano进行导轨部署。在生产服务器上运行bundle install时,这是一个奇怪的错误。捆绑软件安装无法执行,导致导轨生产服务器出错

You are trying to install in deployment mode after changing 
your Gemfile. Run `bundle install` elsewhere and add the 
updated Gemfile.lock to version control. 

If this is a development machine, remove the Gemfile freeze 
by running `bundle install --no-deployment`. 

You have added to the Gemfile: 
* rails (= 3.1.3) 
* mysql2 (>= 0.2.6) 

You have deleted from the Gemfile: 
* rails (~> 3.1.3) 

生产服务器上的Gemfile被手动更改,然后出现此错误。这是一个新的生产服务器,我们计划运行rails 3.1.3。我们重新启动了Linux服务器,并没有帮助。有没有办法解决这个问题?非常感谢。

回答

1

我想你正在使用一些部署解决方案,如Capistrano。如果是这种情况,请在开发机器上更改Gemfile,运行bundle install,将所有内容提交到存储库并再次部署。

永远不要在服务器上手动更改代码,这会损害您的业力​​。

编辑:

如果你希望只在生产中使用一些特定的宝石,将它们添加到生产集团。

# Gemfile 
group :production do 
    gem 'mysql2' 
end 
+0

将再试一次。重新提交并重新部署。但问题没有解决。我们不在开发中使用mysql,这是gemfile唯一的区别。 – user938363 2012-03-01 21:52:13

+0

@ user938363:使用捆绑器组。查看更新的答案。 – 2012-03-01 21:55:11

+0

看起来不错,并会尝试。正在改变database.yml文件好吗?我们的帽子将复制宝石文件和database.yml。有了这个组,就不需要复制gemfile。谢谢。 – user938363 2012-03-01 22:01:55