new ruby on rails setup, issues with slow gem updating - ruby-on-rails

I am having a big issue with updating my gems on a new production server I am building.
I am running it on Ubuntu 12.04 LTS.
I have rubygems version 1.8.24, ruby version 1.9.3-p125, rails version 3.2.3.
Whenever i run the command gem update or gem update --system, it took hours for it to complete the first time.
Any ideas as to why this would be slow?
I am trying to see if its something with our firewall; but when I watch the traffic coming from that specific server, I am not seeing any deny messages.
Below i have added the command line view when i did sudo gem install rails -V
This is not all the code it is just the last 1000 lines since i had a limit on my terminal window.
Hopefully this provides some more insight into what may be happening
gem install rails verbose code

Related

Why am I unable to install Rails on Windows command line

After running the Rails installer on my Windows 7 laptop, the command line with directory set to C:\Sites appears. I try to run the command below
gem install rails
But I get the error below:
Error executing gem ...
(Errno::EMSGSIZE) A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself. - recvfrom(2)
Here is screen shot:
How do I fix this?
Thanks in advance
I'm on Windows 10 and I had exactly the same error:
The same buffer issue is being addressed here: https://github.com/juthilo/run-jekyll-on-windows/issues/40 as commented out by Tim, however, the gem being installed is jekyll.
I thought I'd install it on my end too and interestingly it worked:
So I thought I'd try to do an update. The holy grail (at least for me) is:
gem update --system
and then do an install on your rails gem:
gem install rails --no-ri --no-doc
worked like a charm! I had --version 4.0.0 appended as I needed a rather older version of the rails. I'm expanding my skill set and I'm just getting started with ROR.
Hope it helps!

Issue with json 1.8.1 gem in rails app on production

I am trying to configure my server for hosting my rails app. Getting this error
An error occurred while starting up the preloader. It exited before signalling successful startup back to Phusion Passenger. Please read this article for more information about this problem.
Raw process output:
/usr/local/rvm/gems/ruby-2.1.2/gems/json-1.8.1/lib/json/common.rb:67: [BUG] Segmentation fault
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
I am using RVM and migrated from version 1.9.1 to 2.1.2 of ruby. Any pointers would greatly help. Going mad from last 2 days to set up the server
Based on the information provided it seems that the ruby version being used doesn't match up with the version identified in the gemset directory. Perhaps this issue will shed some more light.
1) Install new version of Ruby
2) Either set it as the default Ruby, or create a .ruby-version file specifying which Ruby version you wish to use in your project
3) Navigate to the project directory and type ruby -v to verify the version being used is the correct one
4) Install gems using bundler. You might want to create a separate gemset for this project just to keep things clean and segregated
5) Determine the correct configuration between your HTTP server and Phusion Passenger. Are you using Apache or nginx? Both require you to set the ruby version somewhere and it needs to point to your new Ruby installation (link uses nginx as an example).
Now you have a new version of Ruby installed and both local command line execution uses it as well as Phusion Passenger. Restart your server and see if it works. If it doesn't, you'll need to provide step-by-step details for me to help further.
try this out:
try running server with bundle exec rails s
OR
remove the .bundle/ directory and re-bundle with rm -rf .bundle/ && then bundle
I received the same error. Rails also threw a segmentation fault & core dump. Clobbering my Gemfile.lock and re-running bundle install did the trick:
rm Gemfile.lock
bundle install

Rails - Closed terminal and rebooted machine - now bash tells me rails isn't installed

Running OSX Mavericks, ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0], rvm 1.25.23 (master), and rails-4.1.0 (allegedly)
I'm working through the railsapps.org book on learning rails and made it about 1/2 way through yesterday. When I stopped for the day, I closed out iTerm2 and shut off the Macbook Pro. Today, I powered up, opened iTerm, navigated to my working directory (~/rubyonrails/learn-ruby) and entered rails -v.
I see this:
`Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.`
So I run sudo gem install rails and it shows that it has installed rails-4.1.0. Now rails -v still gives me the same error message above.
I tried also running rvm use ruby-2.1.1#learn-rails first and I still get the error message.
So I'm a little stuck and I can't figure out what to do to get rails working. Also, how do I go about setting up the bash environment such that I don't have to go through this each time? It would be nice to nav to my working directory and just start work without having to do a bunch of re-installation and reconfiguration each time.
Regards,
Jeff
please type in your shell:
$ bash --login
and then repeat your commands.
rails -v
Also try to call it with the full path:
like:
/your/path/to/rails -v
I think that the shell just doesn't know where rvm/rails etc is located.
You can solve this by entering:
$ source ~/.rvm/scripts/rvm
When you switch to the ruby-2.1.1#learn-rails ruby/gemset combo, and do gem list, what do you see?
The way people usually use rvm is to have every project folder specify the ruby & gemset it uses (they don't all have to be different). This is done with files called .ruby-version and .ruby-gemset. These should contain, in your case, ruby-2.1.1 and learn-rails respectively.
Set these if you haven't already, then leave the folder and enter it again. Then do bundle install to install the gems for the project into the rvm/gemset combo.
Your problem is that you ran
sudo gem install rails
The error message telling you to do this comes from your system Ruby, which doesn't know that you want to use RVM.
RVM installs gems into your user-space directory. By using sudo, you're bypassing this and installing it into (effectively) the superuser space, i.e. globally.
If you instead just run
gem install rails
then you'll be using RVM's copy of the gem utility rather than the globally installed version.

Can't boot WEBrick, the folder for Rails gem is empty

I'm following Michael Hartl's Ruby on Rails tutorial, and I got stuck at trying to start rails server on my Windows 7 machine.
I'm trying to do this by following instructions in Chapter 1.2.5., i.e. by typing
rails server
However, instead of booting WEBrick, this returns the instructions for usage of 'rails' command. I've been googling this for a while, and some of the answers seem to have implied that something is wrong with the rails gem.
Now, I've found the rails gem folder ("C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\rails-3.2.3"), and it's empty!
Also when I try
rails -v
it returns "Rails 3.2.16", although I've removed this version of the gem; if I try
gem list
it kept telling me that the version is 3.2.3.
This persisted until I deleted railties version 3.2.16, which resulted in
rails -v
returning 'Rails 3.2.3', but I still can't boot WEBrick.
Any help would be appreciated.
Did you run the installer?
At the time of this writing, I recommend using the Ruby 2.0.0-p353.
http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.0.0-p353.exe?direct
Save yourself some future gem headaches and install the DevKit too.
http://rubyinstaller.org/downloads/
It should create a folder at C:\Ruby200. Start a new command prompt for the new paths to take affect.
Once Ruby is install, gem install Rails. From your other post, I recommend gem install rails -v 3.2.16
Then execute rails new project_name, then cd project_name. Then run rake db:migrate to create the initial database. At this point, you should be able to run rails server and visit localhost:3000 in your browser.
OK, I've managed to solve my problem.
I've seen a few more people having the same issue, but none of the solutions that I've found helped me, so here's what did it for me, though I'm not 100% sure what exactly was that one thing that actually did it...
I've followed the advice #scarver2 gave in response to my other question, and uninstalled both Rails and Railties gems from my crispy fresh installation of Ruby 1.9.3. (I've installed it using RailsInstaller). Then I've installed Rails 3.2.16 gem by typing
gem install rails -v 3.2.16
and this also installed the corresponding Railties 3.2.16 gem without my intervention.
Then I followed steps from chapters 1.2.3. and 1.2.5. of the tutorial, but making sure that line referencing ruby version in my Gemfile actually corresponds to the version of Ruby that I have installed.
I typed
ruby -v
in the console, to make sure that I have version 1.9.3. indeed. Confirming this, I've edited the Gemfile in my app so it says
ruby '1.9.3'
instead of ruby '2.0.0' line that's used in Listing 1.5. of the tutorial.
After that I've simply went to my app folder, and typed
bundle update
bundle install
in the console, and this time it did not return any errors as it did in my previous attempts. After that, typing
rails server
did what it should have, and my WEBrick server booted, allowing me to access my app on localhost. Yay!
Now, what I think may have gone wrong the last time was either me screwing up the Gemfile, so the gem versions and their dependencies got messed up. I also assume that ineptly trying to fix this by installing and uninstalling different versions of various gems did not quite help. What may have helped was uninstalling Rails and Railties gems, and installing Rails gem again.

no such file to load -- rails/cli under Ruby Enterprise Edition 1.8.7

On a VPS I tried to install Ruby. Because of memory exhaustion problems, we were unable to compile ruby 1.9.2 , and we decided to give Ruby Enterprise Edition a try. This compiled without complaining about memory problems.
Next, we install rubygems, and to test that it's working, I installed haml. It worked.
The next step was to install rails, via gem install rails. The version it downloaded was the latest, 3.0.5. Installation went ok. However, when I try to create a new project, I receive:
no such file to load -- rails/cli
Looking around on the internet, people said this is a problem related to older versions of rails, and some of them suggested to do a gem clean. I didn't have any other version of ruby before, therefore, no other version of rails. But, just to be sure, I did a gem clean and then reinstalled rails. The problem persists.
How can I fix this?
Make sure your running the gem binary that Ruby Enterprise Edition installed. So rather than:
gem install rails
it would be something like:
sudo /opt/ruby-enterprise-X.X.X/bin/gem install rails
To save having to type the whole path each time, you can symlink the REE binaries with something like:
sudo ln -sf /opt/ruby-enterprise-X.X.X/bin/* /usr/bin/.

Resources