Bundle install loop - ruby-on-rails

I'm running ruby 1.8.7 with rails 2.3.14... with bundler.
I've created a new application with:
rails new_app
cd new_app
Run the command:
bundle install
the terminal loops here:
Fetching gem metadata from http://rubygems.org/........
anything happen. What's going on?
I will appreciate your help.

Related

Failed generating controller due to Bundler version conflict

I'm learning Rails with tutorials from Ruby on Rails by Michael Hartl: https://www.railstutorial.org/book
I used the following command to generate a controller:
rails generate controller StaticPages home help
Which generates the following error regarding version conflicts:
check_version_conflict': can't activate bundler-1.12.4, already
activated bundler-1.13.0.pre.1 (Gem::LoadError)
I don't know which bundler version to use. The current version of bundler is: 1.13.pre.1
The following command continued failing due to about five gem dependencies that failed to install automatically, which included listen and nokigiri.
bundle install --without production
I tried installing the dependent gems manually, but I'm still having issues.
How do I resolve the check_version_conflict issue with Bundler when generating Rails controllers?
I'll accept an answer that instructs removing current Ruby libs and installing a new development environment from scratch.
Bundler will install project-specific versions of your gems so that you don't have to manage global dependencies.
In effect, if you install Rails with bundler and you also install it with sudo gem install rails or something like that, you'll have two versions on your computer. By default, calling rails will refer to the global version.
If you call bundle exec rails (or bundle exec <gem_name>), it will call the bundler-specific version.
Ten steps to resolve your issues with Bundler
(optional) Uninstall Ruby. There are many ways to do so, here's one: https://superuser.com/questions/194051/how-to-completely-remove-ruby-ruby-gems-on-mac-os-x-10-6-4
(optional) Use rbenv to install Ruby. Follow instructions here: https://github.com/rbenv/rbenv
Make a repo directory that will house your future Rails app
From the command line:
mkdir repo
cd repo
Install Bundler and create a Gemfile for the directory
From the command line:
gem install bundler
bundle init
Open the repo/Gemfile with your editor, and configure it to instruct Bundler which version of Rails to install
In repo/Gemfile:
source "https://rubygems.org"
gem "rails", "4.2.6"
Install Rails via Bundler
From the command line:
bundle install
Create a new Rails app using Bundler, and cd into it
From the command line:
bundle exec rails new whatevs
cd whatevs
Your Rails app will have a Gemfile by default. Open it and add the gems you wish to use in your app.
In repo/whatevs/Gemfile:
gem 'nokogiri', '1.6.8'
From repo/whatevs/ directory, install your app's Gems via Bundler
From the command line:
bundle install
From repo/whatevs/ directory, generate a controller
From the command line:
bundle exec rails generate controller static_pages home help

Rails from directory of application doesn't work

I have installed rails.
Once installed I create a application with
$ rails new my_app
and I ran the rail server from the directory of the application.
~/rails_projects/my_app$ rails server
The problem is that after exiting the application when I go to that directory later I can't run the server this second time.
~/rails_projects/my_app$ rails server
Could not find gem 'spring (>= 0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
It doesn't show any Rails version from that directory but yes from the home directory:
~$ rails -v
Rails 4.1.1
~/rails_projects/my_app$ rails -v
Could not find gem 'spring (>= 0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems
It seams you are starting with Rails. Please follow the official guide to get an inside of the framework.
To get started you need to create a project:
$ rails new my_app
then go the project directory:
$ cd my_app
install dependencies (if you add any to your Gemfile):
$ bundle install
and then run the server
$ rails server
Again, if you are starting follow that guide!

Regarding gem file editing

I executed 'gem install mongoid' and 'gem install bundler' to work with MongoDB in Rubyonrails these two commands executed with out any errors but when i am trying to execute bundle update
I am getting errors like Bundler could not find compatible version for gem "äctivemodel" in Gemfile:.I am new to ruby programming rails and mongodb can you help me to resolve this isssue?
I solved it by deleting the lock rm Gemfile.lock and again running bundle install

Ruby on rails error when running rails s

Um quite new to rails and um getting an error when run the command
rails s
it says
Could not find rake-0.9.2.2 in any of the sources
Run bundle install to install missing gems.
when I run bundle install nothing happened
my gem list has rake 0.9.2.2
what can go wrong?
my ruby version is 1.9.3
Thank you in advance
Remove all the versions of Rake ==> gem uninstall rake
Remove your gemfile.lock => rm Gemfile.lock
Remove gem 'rake' on your gemfile
Run bundle install
Install Rake manually : gem install rake --version=10.0.4
When you use command gem list, you will get a list of gem installed on your machine.
For example : rake (10.0.4, 10.0.3, 0.9.2.2)
Just see the console which gem is compatible with your application. It is already mentioned in the error log message.
Use
gem uninstall rake
Keep the suitable one and remove the version who is creating trouble. And then run rails s or bundle exec rails s
Try using rvm and go back to ruby 1.8.7 instead of 1.9.2. This fixed it for me. Don't forget to install rails again (sudo gem install rails while already on 1.8.7) if you have only installed rails for 1.9.3.]

Why it's so slow to use `rails new`?

The version is:
bash-3.2$ rails -v
Rails 3.2.9
And my ruby is the built-in ruby on MacOSX:
bash-3.2$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
bash-3.2$ which ruby
/usr/bin/ruby
My problem is that in the last step of rails new ( run bundle install), it seems that rails need to connect the internet to download some packages. And usually I need 5 minutes just wait for rails to create any project using rails new.
I was wondering whether somethings is not configured well for rails on my computer.
Another strange thing is that after I finished rails new PROJECT_NAME, it shows:
Using sqlite3 (1.3.6)
Using uglifier (1.3.0)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
It seems that sqlite3 has already been installed, however, when I try:
bash-3.2$ bundle show sqlite3
Could not locate Gemfile
It still complains that sqlite3is not installed. Maybe that's the reason that rails new is slow (Even sqlite3 has been installed once. It still needs to download the bundle)
Before bundle install, rails asks for my system password:
Enter your password to install the bundled RubyGems to your system
But I'm still not sure whether these packages have been installed into system, as bundle show sqlite3 failed.
Does anyone have ideas about why rails new is so slow on my computer? Thanks!
Another solution is to use RVM. It is similar to rbenv. I personally use RVM. I don't and would not recommend using the gemsets. Bundler does the separation of gem versions anyway.
Check what is up with your bundle install i.e. the last step in the rails new sequence. Run this instead:
rails new appname -B
The -B flag tells rails to "skip bundle" (reference). Then go into the app folder to run:
bundle install --verbose
Check for potential errors in the output.
Using different bundler versions can give you different results. So try other versions.
gem uninstall bundler -v your-version-number
gem install bundler -v new-version-number
In 2016, we got bundler v1.12.x which is causing some users to experience slow bundle install issues. In this case, using 1.11.2 is the faster option until they fix it.

Resources