How to install Ruby via rvm1-capistrano3 - ruby-on-rails

I want to install rvm via rvm1-capistrano. Every time I run the task it tells me that Ruby [version] is not installed. Which is weird because I already know its not installed, and this is why I'm running the task: To install it. Why is this?
This is a vanilla out of the box installation. I've not changed anything. I added the following:
set :rvm_ruby_version, '2.0.0-p353' # to deploy.rb, same error w/without
set :pty, true # deploy.rb
require 'rvm1/capistrano3' # to Capfile
Per others' recommendation, I added a .ruby-version to the root of my app with 2.0.0 as contents.
What am I not understanding correctly? Why would the task charged with installing ruby tell me ruby is not installed?
DEBUG [09203819] Command: cd ~/apps/simpleblog/releases/20140121174439 && /usr/bin/env /tmp/simpleblog/rvm-auto.sh rvm install .
DEBUG [09203819] ruby-2.0.0-p353 is not installed.
DEBUG [09203819]
DEBUG [09203819] To install do: 'rvm install ruby-2.0.0-p353'
DEBUG [09203819]
DEBUG [09203819] Searching for binary rubies, this might take some time.
DEBUG [09203819]
DEBUG [09203819] No binary rubies available for: ubuntu/13.10/x86_64/system.
DEBUG [09203819]
DEBUG [09203819] Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
DEBUG [09203819]
DEBUG [09203819] RVM does not have prediction for required space for system, assuming 150MB should be enough, let us know if it was not.
DEBUG [09203819]
DEBUG [09203819] Either the ruby interpreter is unknown or there was an error!.
DEBUG [09203819]

Related

Using rvm bundle install doesn't install rails

I'm freshly using rvm for running a legacy project.
I installed rvm fine. Running which ruby gives the correct rvm version:
/Users/Mahmoud/.rvm/rubies/ruby-2.5.5/bin/ruby
Then running which bundle, also indicates that bundle is using the correct rvm version:
/Users/Mahmoud/.rvm/rubies/ruby-2.5.5/bin/ruby
Now to get my project running, I run bundle install. It's important to stress on the fact that in my Gemfile I have
gem 'rails', '5.0.7'
Running rails s after those steps, gives:
Rails is not currently installed on this system. To get the latest version, simply type:
Running which rails gives:
/usr/bin/rails
implying that the system version and not the rvm version is being used.
echo $PATH shows:
/Users/Mahmoud/.rvm/gems/ruby-2.5.5/bin:/Users/Mahmoud/.rvm/gems/ruby-2.5.5#global/bin:/Users/Mahmoud/.rvm/rubies/ruby-2.5.5/bin:/Users/Mahmoud/.rvm/bin:/Users/Mahmoud/.pyenv/versions/3.7.2/bin:/usr/local/bin:/Users/Mahmoud/.pyenv/bin:/usr/local/opt/openssl#3/bin:/usr/local/opt/openssl#3/bin:/usr/local/opt/libxml2/bin:/usr/local/opt/mysql#5.7/bin:/usr/local/opt/mysql#5.7/bin:/usr/local/opt/mysql#5.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/MacGPG2/bin:/Library/Apple/usr/bin:/Users/Mahmoud/.ebcli-virtual-env/executables:/usr/local/mysql/bin
My question is, why hasn't rails been installed when I used bundle install? And why is which rails refering to my system and not my rbenv path?
I'll bet your RVM isn't set up correctly and /usr/bin/ appears in your PATH before RVM's bin directory. Run echo $PATH to confirm.
If so, back up your dotfiles for safety and run rvm get head --auto and it should put your PATH right. Logout and log back in or source your dotfiles (source ~/.bash_profile or whatever) and try again.

rails -v cannot load such file -- rails/cli (LoadError)

Ubuntu 14.04.
So everything was working fine and I had my terminal open with two tabs - one tab had webbrick running on my sebcoles project, and the other tab I used to clone my english_teacher repo. It all downloaded fine and I changed into the directory.
I'll just paste everything here - it's all pretty clear:
andrew:projects$ cd pinteresting
RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore /home/andrew/projects/pinteresting/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.
ruby-2.1.5 is not installed.
To install do: 'rvm install ruby-2.1.5'
andrew:pinteresting$ rvm install ruby-2.1.5
Warning, new version of rvm available '1.26.11', you are using older version '1.26.10'.
You can disable this warning with: echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with: echo rvm_autoupdate_flag=2 >> ~/.rvmrc
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/14.04/x86_64/ruby-2.1.5.tar.bz2
Checking requirements for ubuntu.
Requirements installation successful.
ruby-2.1.5 - #configure
ruby-2.1.5 - #download
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 23.1M 100 23.1M 0 0 1189k 0 0:00:19 0:00:19 --:--:-- 1381k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.1.5 - #validate archive
ruby-2.1.5 - #extract
ruby-2.1.5 - #validate binary
ruby-2.1.5 - #setup
ruby-2.1.5 - #gemset created /home/andrew/.rvm/gems/ruby-2.1.5#global
ruby-2.1.5 - #importing gemset /home/andrew/.rvm/gemsets/global.gems....................................
ruby-2.1.5 - #generating global wrappers........
ruby-2.1.5 - #gemset created /home/andrew/.rvm/gems/ruby-2.1.5
ruby-2.1.5 - #importing gemsetfile /home/andrew/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.1.5 - #generating default wrappers........
andrew:pinteresting$ heroku status
=== Heroku Status
Development: No known issues at this time.
Production: No known issues at this time.
andrew:pinteresting$ rails s
/home/andrew/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- rails/cli (LoadError)
from /home/andrew/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/bin/rails:7:in `<main>'
andrew:pinteresting$ rails -v
/home/andrew/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- rails/cli (LoadError)
from /home/andrew/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/bin/rails:7:in `<main>'
So, basically I'm screwed at the moment - I can't do anything. Help!
You have installed rvm but forget to install rails gem. Install it use:
gem install rails
Turns out I just had to run
bundle install
and everything was fine. However, for my pinteresting repo, which uses the paperclip gem, I had to run
sudo apt-get install imagemagick
in order to upload images in development.
Haven't dared commit anything new and push and deploy to heroku yet though. I think it should be fine though (touch wood).
I too had the same error. I forgot to switch to correct ruby version and correct gemset using rvm. That's it, I was able to sort this issue.
$rvm list
$rvm use ruby version
$rvm gemset use gemset-name

Installing Ruby with rvm1-capistrano3

When I run
cap production rvm1:install:ruby
I get this error at the end of the console output:
Command: cd ~/apps/foo/releases/20140121133714 && ( PATH=/opt/ruby/bin:$PATH /usr/bin/env /tmp/foo/rvm-auto.sh rvm install . )
Could not determine which Ruby to use; . should contain .rvmrc or
.versions.conf or .ruby-version or .rbfu-version or .rbenv-version, or an appropriate line in Gemfile.
cap aborted!
EDIT
After adding an .ruby-version at the root of my app, with the contents I get
DEBUG [af3b80bc] Command: cd ~/apps/foo/releases/20140121160854 && /usr/bin/env /tmp/foo/rvm-auto.sh rvm install .
DEBUG [af3b80bc] ruby-2.0.0-p247 is not installed.
DEBUG [af3b80bc] To install do: 'rvm install ruby-2.0.0-p247'
DEBUG [af3b80bc] ruby-2.0.0-p247 is not installed.
DEBUG [af3b80bc] Searching for binary rubies, this might take some time.
DEBUG [af3b80bc] ruby-2.0.0-p247 is not installed.
DEBUG [af3b80bc] Searching for binary rubies, this might take some time.
DEBUG [af3b80bc] No binary rubies available for: ubuntu/12.10/x86_64/system.
DEBUG [af3b80bc] Searching for binary rubies, this might take some time.
DEBUG [af3b80bc] Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
DEBUG [af3b80bc] Searching for binary rubies, this might take some time.
DEBUG [af3b80bc] RVM does not have prediction for required space for system, assuming 150MB should be enough, let us know if it was not.
DEBUG [af3b80bc] Searching for binary rubies, this might take some time.
DEBUG [af3b80bc] Either the ruby interpreter is unknown or there was an error!.
I'm running Capistrano 3.1.1 with rvm1-capistrano gem. It's out of the box implementation; nothing special going on.
group :development do
gem 'capistrano', '~> 3.1.0'
gem 'capistrano-rails'
gem 'capistrano-bundler'
gem 'rvm1-capistrano3', require: false
# gem 'capistrano-rvm'
end
# capfile
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rails'
require 'capistrano/bundler'
require 'rvm1/capistrano3'
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
I'm also getting two other errors in the output:
Running /usr/bin/env [ -L ~/apps/foo/releases/20140121135720/public/assets ] on foo.com
Command: [ -L ~/apps/foo/releases/20140121135720/public/assets ]
Finished in 0.291 seconds with exit status 1 (failed).
Running /usr/bin/env [ -d ~/apps/foo/releases/20140121135720/public/assets ] on foo.com
Command: [ -d ~/apps/foo/releases/20140121135720/public/assets ]
Finished in 0.295 seconds with exit status 1 (failed).
Problem
If you go to the remote server and execute this:
cd ~/apps/foo/releases/20140121160854 && /usr/bin/env /tmp/foo/rvm-auto.sh rvm install .
you will get the same error but if you execute this instead
cd ~/apps/foo/releases/20140121160854 && /usr/bin/env /tmp/foo/rvm-auto.sh rvm install ruby-2.0.0-p247
success.
The problem appears when rvm-auto.sh execute the rvm install . command. Not sure if is a rvm problem but it looks so to my eyes..
Workaround
If you specify the desired version of ruby to install in config/deploy.rb:
set :rvm1_ruby_version, "ruby-2.0.0-p247"
before executing any rvm1 tasks. Everything should be fine
The application does not know which version of ruby to use.
All you need to do is add a file called .ruby-version to the root of your application, and have its contents be
1.9.3
Or whatever version of ruby you are using.
You may also need a .ruby-gemset file. In which case, its contents should be
some_gemset_name
You can call your gemset whatever you want. It is local to your application.

installing ruby-2.0.0 Error running 'make -j4',

Does anyone have had this same error before while installing ruby 2.0.0 in rails 4.0?
all this in a MAC OS X 10.8.2
Error running 'make -j4'
couldn't find any answers.
I agree with devnull, we would need a log of some sort to narrow down your problem.
Though I did just install ruby 2.0 on a mac 10.8.4 yesterday using RVM.
Try following the instructions here. That made it very simple.
FWIW, here's the process I went through. Some of the commands might be specific to my environment and you may have to adjust accordingly. This process was a mix and mash of recommendations from various sources, but also following along with whatever the output spit out. I found that I was unable to install ruby 2.0 just from following other stack overflow threads as written, so I had to improvise, somewhat. Hope this helps.
Made sure i downloaded the latest Xcode and Command Line tool (seems to be the general recommendation out there)
run 'brew doctor'
run 'brew update'
run 'rvm requirements'
run 'rvm get head'
Kept seeing this error "Can not automatically remove lines with 'rvm_autolibs_flag=' from '/etc/rvmrc', please clean it manually."
run 'rvmsudo --debug' #as recommended in terminal, but this still wasn't fixing the problem, so i tried....
run 'rvmsudo rvm get head' #because the output recommended 'prefix the command with rvmsudo to fix it'
run 'rvm requirements'
run 'rvm install 2.0.0' #error "There is no checksum for 'http://production.cf.rubygems.org/rubygems/rubygems-2.0.5.tgz' or 'rubygems-2.0.5.tgz', it's not possible to validate it.......If that does not resolve the issue and you wish to continue with unverified download
add '--verify-downloads 1' after the command."
run 'rvm reinstall 2.0.0 --verify-downloads 1'
run 'rvm default 2.0.0'
And it finally worked. My Ruby verison is now ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0].

Cant install rails on my brand new Mac OS X Lion 10.7.3

Just got a new macbook pro and im having troubles installing rails..
I got ruby 1.8.7 already installed and when i try to write 'gem install rails' i get:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.
I also tried to install a higher version of ruby and it said:
Nirs-MacBook-Pro:~ nirohayon$ rvm install 1.9.3
Fetching yaml-0.1.4.tar.gz to /Users/nirohayon/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/nirohayon/.rvm/src
Configuring yaml in /Users/nirohayon/.rvm/src/yaml-0.1.4.
Error running ' ./configure --prefix="/Users/nirohayon/.rvm/usr" ', please read /Users/nirohayon/.rvm/log/ruby-1.9.3-p125/yaml/configure.log
Compiling yaml in /Users/nirohayon/.rvm/src/yaml-0.1.4.
Error running 'make ', please read /Users/nirohayon/.rvm/log/ruby-1.9.3-p125/yaml/make.log
Database file /Users/nirohayon/.rvm/config/packages does not exist.
Installing Ruby from source to: /Users/nirohayon/.rvm/rubies/ruby-1.9.3-p125, this may take a while depending on your cpu(s)...
ruby-1.9.3-p125 - #fetching
ruby-1.9.3-p125 - #extracted to /Users/nirohayon/.rvm/src/ruby-1.9.3-p125 (already extracted)
ruby-1.9.3-p125 - #configuring
Error running ' ./configure --prefix=/Users/nirohayon/.rvm/rubies/ruby-1.9.3-p125 --enable-shared --disable-install-doc --with-libyaml --with-opt-dir=/Users/nirohayon/.rvm/usr ', please read /Users/nirohayon/.rvm/log/ruby-1.9.3-p125/configure.log
There has been an error while running configure. Halting the installation.
ls: /Users/nirohayon/.rvm/rubies/*/bin/ruby: No such file or directory
PLEASE help me, i used windows before and also pretty new to rails, so i dont know much about which path should i direct my terminal. i need a step by step explanation to put rails up and standing on my mac.
Thanks so much!
Nir
Your use of RVM looks a lot like you don't have the developer tools installed. Grab XCode from the App Store, the install the command line tools!
If you really want to install rails on the platform-provided ruby, all you need to do is to sudo gem install rails, for you need to use administrator privileges to isntall gems in the system gemset.
This tutorial helped me install on mac before with OS X 10.6 (I believe). The only thing that was a trouble was the C compiler, which I figured out was the problem from looking up one of the errors.
Probably you will find by looking up the output Error running 'make ', please read /Users/nirohayon/.rvm/log/ruby-1.9.3-p125/yaml/make.log by typing vi /Users/nirohayon/.rvm/log/ruby-1.9.3-p125/yaml/make.log type esc key followed by typing :q! to quit.
As previous answer suggested, you need to get a compiler. I don't know about Xcode specifics, but I tracked down an installer for GCC compiler for Mac on Github I believe but it is probably better straight from Apple packages, (tutorial here)
Also note that if you end up having to use sudo at all, you've probably gone off-track from the guide to install RVM on your system. In which case your path will be somewhere other than in the home directory and the instruction to adjust your source with echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bash_profile will not work. Which may end up being somewhere like "/usr/local/rvm/scripts/rvm"

Resources