Rails deployment Capistrano - capistrano/cli (LoadError) - ruby-on-rails

I followed this tutorial.
https://gorails.com/deploy/ubuntu/14.04#capistrano
Now i am stuck at this
I ran this command after set Adding The Nginx Host
cap production deploy
and ran into this, now no idea what to do.
/home/deploy/.rbenv/versions/2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- capistrano/cli (LoadError)
from /home/deploy/.rbenv/versions/2.2.4/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire'
from /usr/bin/cap:3:in `'

I solve this problem by remove old Capistrano gem.
# remove all old versions of the gem
gem cleanup rjb
I have the same error and it's because I installed this Gem and upgraded my ruby from 2.0.0 to 2.1.9. Reinstallation resolves my issue.
Hope this can help you.
If you still have this problem, I highly recommend you use bundler and
bundle exec cap <args>

Related

Ruby failing to run after upgrading (sqlite3_native LoadError); sqlite3 not upgrading properly

I have upgraded to ruby 2.5.0 but I am having conflicts everywhere. I have checked previous posts on stack overflow such as:
Ruby on Rails - "Add 'gem sqlite3'' to your Gemfile"
cannot load such file — sqlite3/sqlite3_native
cannot load such file -- sqlite3/sqlite3_native (LoadError) on ruby on rails
https://github.com/sparklemotion/sqlite3-ruby/issues/137
But none of them are working for me. My issue is similar to these posts in that after I run rails server after a long error message the last few lines read:
1: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in 'block in require'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in 'require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
I have tried creating a new project, reinstalling sqlite3 through gem and minigw itself, reinstalling rails and ruby. I have tried most of the instructions in the previous questions but nothing works. SQLite3 version 3.25.2, Ruby 2.5.3, rails 5.2.1
Sorry, this might be a simple fix but I am a complete beginner to ruby and I have been trying different things for a few hours now. Any help is appreciated.
As explained in this answer https://stackoverflow.com/a/49736971/4685144, you should now be able to install sqlite3 using git:
gem 'sqlite3', git: 'https://github.com/sparklemotion/sqlite3-ruby'
Then bundle install

Cannot run Unicorn with Ruby 2.0

On my ubuntu machine, I can run unicorn on ruby 1.9.3, however, it does not seem to work with ruby 2.0. Any idea why?
root#dev:/home/karan# rvm use 1.9
Using /usr/local/rvm/gems/ruby-1.9.3-p429
root#dev:/home/karan# unicorn -v
unicorn v4.6.3
root#dev:/home/karan# rvm use 2.0
Using /usr/local/rvm/gems/ruby-2.0.0-p195
root#dev:/home/karan# unicorn -v
/usr/local/rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- unicorn/launcher (LoadError)
from /usr/local/rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /usr/bin/unicorn:3:in `<main>'
Try reinstalling the gem with 2.0.0.
The problem must have been caused by the fact the gem was installed in 1.9.3.
I have the exact same problem when I try to start Unicorn server
Starting Unicorn web server unicorn
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- unicorn/launcher (LoadError)
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' from /usr/bin/unicorn:3:in `<main>'
Nevertheless, Unicorn works fine when I run it from the rails app folder, simply using "unicorn" command.
I have tried what you suggest, installing the gem unicorn
gem install 'unicorn'
But it does not change the result
I check what gem is installed:
which gem 'unicorn'
/usr/local/rvm/rubies/ruby-2.0.0-p353/bin/gem
/usr/local/rvm/gems/ruby-2.0.0-p353/bin/unicorn
I am running unicorn from a etc/init.d script that you can see here:
http://pastebin.com/qvwdmRJ2
and here for the default configuration:
http://pastebin.com/84FBQjMp
There seems to be some problem with the PATH of the default configuration file:
PATH=/usr/local/rvm/rubies/ruby-2.0.0-p353/bin:/home/unicorn/.rvm/bin:/usr/local/sbin:/usr/bin:/bin:/sbin:$
Because since I updated it with the new installed version I get the error message shown at the top. If I remove it, Unicorn "apparently starts" but the log shows a crazy activity and nginx shows an empty screen.
I am trying to find a solution and will share it here as soon as I find it.
Thanks for your help
* UPDATE *
OK I have found the problems:
1) for the /etc/init.d script:
You need to create a wrapper for Unicorn to work in a init.d type of script:
rvm wrapper 2.0.0 ruby-2.0.0 unicorn
then replace the line
DAEMON=/usr/bin/unicorn
with this one:
DAEMON=/usr/local/rvm/bin/ruby-2.0.0_unicorn
And now the command
service unicorn start
more on rvm wrapper here: https://rvm.io/integration/init-d
2) I also had another issue that was difficult to identify in the log:
I had not created a config/environments/staging.rb file

Installing/Running Spork-Rails on Rails 4

After installing spork-rails I get this error when running 'spork':
Andrews-Mac-Pro-4:lb_final chapmanf16$ spork
/Users/chapmanf16/.rvm/gems/ruby-2.0.0-p247/bin/spork:23:in load': cannot load such file - - /Users/chapmanf16/.rvm/gems/ruby-2.0.0-p247/gems/spork-1.0.0rc3/bin/spork (LoadError)
from /Users/chapmanf16/.rvm/gems/ruby-2.0.0-p247/bin/spork:23:in'
from /Users/chapmanf16/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in eval'
from /Users/chapmanf16/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in'
If I run 'sudo spork' none of my gems are being located. I will get the following errors:
Using RSpec, Rails
Preloading Rails environment
Could not find actionpack-4.0.0 in any of the sources
It literally can't find any gems because if I list the versions of the gem being mentioned and install only the version it is asking for, it will tell me the next gem is not install. I'm just trying to figure out why the path to my gemfile is not being recognized by spark. I have only started learning ruby/rails for the past 3 days so I'm completely out of my element, but I am really not sure what to do. Any help would be appreciated.
I also posted this question I have on spark-rails github -https://github.com/sporkrb/spork-rails/issues/20
spork-rails from RubyGems doesn't support Rails 4. Try to update you Gemfile with a github reference for the spork:
gem 'spork-rails', github: 'sporkrb/spork-rails'
and run bundle update

Installing a forked github gem of Toto

Ok, this is probably simple, but I'm having a bit of a pain trying to get it to work.
So I was using the gem "Toto", which I installed using "sudo gem install toto", but I recently found a fork of the gem I would rather use here https://github.com/evaryont/toto.
I tried specifying the gem url with --source, but I guess github doesn't support gems anymore aside from "the list". I then tried downloading the forked source and running "rake build" and "rake install" which seemed to create a gem just fine, but when I plug it back into the same application which comes with the gem, it fails to load.
It dies like this.
computer:myblog User$ thin start -R config.ru
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- toto (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from config.ru:2
from /Library/Ruby/Gems/1.8/gems/rack-1.3.0/lib/rack/builder.rb:51:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/rack-1.3.0/lib/rack/builder.rb:51:in `initialize'
from config.ru:1:in `new'
from config.ru:1
Sample Toto Application
git clone git://github.com/cloudhead/dorothy.git myblog
I'm also a little discouraged about building the gem like this because I'm hosting on Heroku, and I would like to make sure that I can use this gem on there as well. I suppose I may have to unpack this gem and commit it to my source?
Update
I also tried using bundler with the following in my Gemfile, and I get the same error, would this mean its just an incompatibility in the sample code and the forked gem?
gem "toto", :git => "git://github.com/evaryont/toto.git"
Are you running in a context where the gem exists? Bundler handles :git-installed gems by cloning the source and storing it in a special directory for bundled gems. It's not actually installed to your system, and won't run unless bundler is running first.
Try this:
bundle exec thin start -R config.ru

running rake fails with Gem::GemNotFoundException ERR

Backstory:
New to rails and attempting to install Passenger on a Mediatemple DV server. I am following and somewhat modifying this CentOS guide here since MT currently does not have any recommended 'how tos' regarding setting up a Rails production environment http://www.freshblurbs.com/installing-ruby-rails-3-centos-nginx.
I have fresh-ly installed gem and then ran gem install rake as root. Now, anytime I try to run
rake some_task
I get the following error
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:370:in `bin_path':
can't find gem rake ([">= 0"]) with executable rake (Gem::GemNotFoundException)
from /usr/local/bin/rake:19:in `<main>'
rake is installed here /usr/local/bin/rake
$PATH is /usr/kerberos/sbin:/usr/kerberos/bin://sbin://bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/bin:/usr/local/bin:/root/bin:/usr/bin:/usr/local/lib
output of gem which rake is /usr/local/lib/ruby/1.9.1/rake.rb
... and unfortunately that's about all I got up my sleeves. What am I missing that's causing this to bomb?
Thanks in advance!
I have the similar problem with rake, but in ruby 1.9.2.
http://betterlogic.com/roger/2010/11/ruby-1-9-2-rake-woe/
Maybe in your case it will be helpful too.
Not sure this'll help maybe it will.. maybe not..
But run a gem list first and make sure both rake and also the passenger gem show up. I think I remember seeing a similar error that was misleading trying to setup a production server recently when running:
passenger-install-apache2-module
face palmed when I realised i hadn't installed the passenger gem yet

Resources