使用捆绑器将Rails应用返回开发模式 [英] Return Rails app to development mode with bundler
问题描述
我已使用Capistrano和Passenger将我的应用程序部署到远程计算机上。该项目位于GitHub上,我想在本地计算机上进行一些错误修复。我已经同步了所有内容,并分支到了本地计算机上的新 dev分支。当我尝试开发时一直使用的简单的 rails服务器
命令时,我收到与我的Gemfile中捆绑的gem有关的错误,例如`require':没有要加载的文件-nokogiri / nokogiri(LoadError)
。但是当我运行 bundle show nokogiri
时,它显示在 /vendor/cache/ruby/1.9.1/gems/nokogiri-1.5.0
。
I've deployed my app to a remote machine using Capistrano and Passenger. The project is on GitHub, and I want to work on some bug fixes on my local machine. I've synced up everything, and branched to a new 'dev' branch on my local machine. When I try the simple rails server
command I had been using while developing, I get errors relating to the gems bundled in my Gemfile, e.g. `require': no such file to load -- nokogiri/nokogiri (LoadError)
. But when I run bundle show nokogiri
, it's present at /vendor/cache/ruby/1.9.1/gems/nokogiri-1.5.0
.
也许这完全是错误的工作流程,但是如何在本地计算机上进入开发模式,因此我可以在之前测试更改
Maybe this is just the wrong workflow entirely, but how do I get to a development mode on my local machine, so I can test changes before pushing them to the deployed app?
我的Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.10'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
# Bundle the extra gems:
gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'nested_scaffold'
gem 'rest-client'
gem 'pony'
gem 'mail'
gem 'logger'
gem 'json'
gem 'gmail'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
推荐答案
I建议您删除 .bundle
目录(考虑先备份 .bundle / config
中的内容),然后运行软件包安装命令再次。您可以执行 cat .bundle / config
将其内容回显到终端(STDOUT)。
I suggest you delete .bundle
directory (consider backing up whatever's inside .bundle/config
first) and run your bundle install command again. You can do cat .bundle/config
to echo its contents to your terminal (STDOUT).
请确保您通过执行 rvm gemdir
和 gem list
选择正确的宝石集,以查看当前宝石集中的所有宝石。
Make sure you have chosen the correct gemset by doing rvm gemdir
and gem list
to see all the gems in the current gemset.
使用 rails s -e开发启动服务器
(s是服务器的缩写)
Start your server with rails s -e development
(s is short for server)
这篇关于使用捆绑器将Rails应用返回开发模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!