Trying to deploy a Rails 4 app to WebFaction, using their documentation and getting an error locally

守給你的承諾、 提交于 2019-12-12 01:43:48

问题


I am trying to deploy a Rails 4 app via github to Webfaction via Capistrano 2.15.5. Initially I installed Capistrano 3 and was getting errors, so I ended up installing Capistrano 2.15.5 and following webfaction's documentation here:

I spoke with webfaction, and they suggested I try the older Cap 2 version since that's what they're familiar with and wouldn't be updating their documentation for Capistrano 3 for awhile.

I get through all the appropriate steps in their tutorial, and I get a bunch of errors when trying to run "cap deploy:setup" or "cap deploy:check" etc.

Errors in a pastebin, here: (and shown below)

/Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:152:in `require': cannot load such file -- capistrano/setup (LoadError)
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:152:in `require'
    from Capfile:6:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:93:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:180:in `load_from_file'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:89:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `block in load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `each'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `block in load_recipes'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `each'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `load_recipes'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:31:in `execute!'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:14:in `execute'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/bin/cap:4:in `<top (required)>'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `<main>'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>' 
galactica% cap deploy:check
/Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:152:in `require': cannot load such file -- capistrano/setup (LoadError)
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:152:in `require'
    from Capfile:6:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:93:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:180:in `load_from_file'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:89:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `block in load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `each'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/configuration/loading.rb:86:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `block in load_recipes'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `each'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:65:in `load_recipes'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:31:in `execute!'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:14:in `execute'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-2.15.5/bin/cap:4:in `<top (required)>'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `load'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `<main>'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
    from /Users/aronoff/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'

I've tried looking into the files, but I'm unsure really of what the issue is, and I dont know enough ruby to troubleshoot. I was hoping you of you could help me.

Any help would be IMMENSELY appreciated and gittipp'ed!! :)

Thank you in advance! ~Josh


回答1:


I'm guessing you set up your project's configuration with Capistrano 3, and I think the setup for Capistrano 2 is different.

I'm not too familiar with the differences, but the error you're getting is cannot load such file -- capistrano/setup and this post about capistrano 3 references require 'capistrano/setup' as being in the Capfile that capistrano 3 generates.

So I'm guessing that file doesn't exist for capistrano 2. I don't know if capistrano 2 has generators that you could run and let them overwrite the files you have, but if it does, try that?

Or try taking out that line and see if you get a different error? Or revert the commit(s) where you started setting up capistrano 3 and start the configuration process completely over with capistrano 2?




回答2:


Have you installed Capistrano 2 using "gem install" under your ruby v2.0?

rvm 2.0.0 gem install capistrano "your version"

Try this first....




回答3:


I got the same error while deploying my rails 4 application using cap 2.15.5. I did research and found out that the problem was syntax as i switched from cap 3 to cap 2. So if you are using cap v2 only load command work in capfile and Require commands are used only in deploy.rb . So if you are switching from 3 to 2, do keep in mind the syntax as there are lots of changes between cap v2 and cap v3.

Note: For deploying rails 4 application 2.15.5 is the stable capistrano version you can use. Here is the guide link that worked for me : https://gist.github.com/brobertsaz/8660415



来源:https://stackoverflow.com/questions/20228193/trying-to-deploy-a-rails-4-app-to-webfaction-using-their-documentation-and-gett

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!