Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/25.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 on rails 是否可以使用postgres将rails项目从windows部署到linux服务器?_Ruby On Rails_Ruby_Windows_Postgresql - Fatal编程技术网

Ruby on rails 是否可以使用postgres将rails项目从windows部署到linux服务器?

Ruby on rails 是否可以使用postgres将rails项目从windows部署到linux服务器?,ruby-on-rails,ruby,windows,postgresql,Ruby On Rails,Ruby,Windows,Postgresql,当我试图将一个rails项目从windows本地环境部署到linux(CentOS6.5)服务器时,Capistrano3出错 Gem::LoadError: Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile. 不过,我在Gemfile中有一个gem'pg'。我在Gemfile.lock中发现了一行导致问题的代码 pg(0.17.1-x86

当我试图将一个rails项目从windows本地环境部署到linux(CentOS6.5)服务器时,Capistrano3出错

Gem::LoadError: Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile.
不过,我在
Gemfile
中有一个
gem'pg'
。我在
Gemfile.lock
中发现了一行导致问题的代码

pg(0.17.1-x86-mingw32)

当我删除
Gemfile.lock
并在另一个linux虚拟主机上运行
bundle install
时,问题就解决了。但是我找不到在windows中解决这个问题的方法

据我所知,如果我使用
Capistrano
,我必须将
Gemfile.lock
发送到服务器。 在windows中创建的
Gemfile.lock
与在linux或osx中创建的不兼容


是否无法使用capistrano从windows部署到带有postgres的linux服务器?

无论您是否使用windows/linux/mac运行capistrano脚本

请提供完整的系统详细信息(远程计算机)

您是否使用什么(RVM/rbenv)在那里安装了ruby

您是否拥有在机器上构建gems的所有本机扩展


请参阅上面的链接并尝试配置您的系统(这使用Capistrano 2,但使用您的脚本只需按照本文中所述构建机器)

看起来bundler多年来一直存在这一问题:github上当前未解决的“问题”:

原始版本(4年期):

  • 如果你向下滚动到相当远的地方,有一个capistrano黑客自动修复Gemfile.lock,可能值得一试
如果Gemfile.lock引用了Windows特定的gems,那么看起来Heroku实际上删除了Gemfile.lock

发件人:

在Windows上开发时,尽可能在GEM文件中指定。如果您的团队中只有一个开发人员拥有Windows计算机,那么在部署之前,请考虑不检查他们的GEMFILE锁定更改或手动捆绑安装并提交到非Windows机器上。 并且有类似的建议:破解Gemfile.lock


如果您在服务器上运行bundle install,这将根据环境安装一批新的gems,对吗?在Capistrano推送代码后,您是否尝试过使用
bundle install RAILS_ENV=production
?@Paven抱歉,这是一个输入错误。@Tetsu别抱歉。我们会犯错。毕竟我们是人:)@Rich我犯了错误,当capistrano运行
~/.rbenv/bin/rbenv exec bundle安装--binstubs/var/www/example.com/shared/bin--path/var/www/example.com/shared/bundle--无需开发测试--部署--安静
。我通过日志服务器直接运行了相同的命令,然后得到了相同的错误。我知道该命令与bundle install RAILS_ENV=production的功能相同,不是吗?是的,它是相同的,但我认为如果您从
shell运行bundle安装,您将有一个全新的安装环境。