Bundle install not working offline - ruby-on-rails

I got this issue. I think got bundler installed. And since than I am not able to bundle install while creating app in RoR, or bundle install direct within the project.
Kindly help me if you got any issue and found the solution for this.
enter code here :run bundle install
:Fetching gem metadata from https://rubygems.org/.
:Error Bundler::HTTPError during request to dependency API
:Fetching full source index from https://rubygems.org/
:Could not reach https://rubygems.org/

If you have your gems installed, you can use bundle install --local. It is not require internet connection

The following method works for me.
$ rails new blog -B # -B tells rails not to run bundle install
cd blog
$ bundle install --local
Edit the GemFile and uncomment the line "therubyracer"
$ rails server
=> Booting WEBrick
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2013-09-28 19:09:35] INFO WEBrick 1.3.1
[2013-09-28 19:09:35] INFO ruby 2.0.0 (2013-05-14) [i686-linux]
[2013-09-28 19:09:35] INFO WEBrick::HTTPServer#start: pid=1635 port=3000

You will need to be online so that bundler can check with rubygems that you have the latest gems and download them if necessary.

Related

Rails server runs, but rails console is throwing error "not checked out yet"

Rails server runs ok, but rails console won't start... What could be wrong?
user#user-pc:~/Sites/refcms_test$ bundle install
...#installing
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
user#user-pc:~/Sites/refcms_test$ bundle exec thin start
Using rack adapter
-- DEPRECATION WARNING --
The use of 'Refinery::Plugin#activity=' is deprecated and will be removed at version 3.1.
Thin web server (v1.6.3 codename Protein Powder)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop
Server runs...but console not...
user#user-pc:~/Sites/refcms_test$ bundle install
...#installing
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
user#user-pc:~/Sites/refcms_test$ rails console
git://github.com/refinery/refinerycms-page-images.git (at master) is not yet checked out. Run `bundle install` first.
My versions Ruby & Rails:
user#user-pc:~/Sites/refcms_test$ ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]
user#user-pc:~/Sites/refcms_test$ rails -v
Rails 4.1.6
Thanks for help!
I'm facing the same problem today. And finally solved by upgrade spring from 1.3.1 to 1.3.2.
Try running:
bundle install --deployment
Stopping spring worked for me,
spring stop

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!

Bundle install loop

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.

can't find gem rails - Gem::GemNotFoundException

Using ubuntu 10.04, rvm. At first, I've installed ruby 1.9.2 with rvm, gem rails and generated some new project and started it successfully. Everything was working fine. But after changing to another project, executing bundle install command (output looks OK) and starting rails server - error occurs:
rails s
/home/jacek/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/site_ruby/1.9.1/rubygems.rb:316:in `bin_path': can't find gem rails ([">= 0"]) with executable rails (Gem::GemNotFoundException)
from /home/jacek/.rvm/gems/ruby-1.9.2-p318/bin/rails:19:in `<main>'
gem list rails
*** LOCAL GEMS ***
rails (3.2.2)
gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.18
- RUBY VERSION: 1.9.2 (2012-02-14 patchlevel 318) [i686-linux]
- INSTALLATION DIRECTORY: /home/jacek/.rvm/gems/ruby-1.9.2-p318
- RUBY EXECUTABLE: /home/jacek/.rvm/rubies/ruby-1.9.2-p318/bin/ruby
- EXECUTABLE DIRECTORY: /home/jacek/.rvm/gems/ruby-1.9.2-p318/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /home/jacek/.rvm/gems/ruby-1.9.2-p318
- /home/jacek/.rvm/gems/ruby-1.9.2-p318#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
My Path (includes EXECUTABLE DIRECTORY: /home/jacek/.rvm/gems/ruby-1.9.2-p318/bin )
/home/jacek/.rvm/gems/ruby-1.9.2-p318/bin:/home/jacek/.rvm/gems/ruby-1.9.2-p318#global/bin:/home/jacek/.rvm/rubies/ruby-1.9.2-p318/bin:/home/jacek/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
I would be grateful for any help
For me just installed bundler. This makes everything work again.
gem install bundler --no-ri --no-rdoc
If you use the command bundle install to install your gems off of a GEMFILE, it will install the gems into your default system location for gems, as outlined in the bundler docs here. After that, you can use bundlers bundle exec command to execute a command in the context of the bundle, as outlined in the docs here. This will ensure that the version of the gem you installed using bundle install is executed.
If you look at the homepage for bundler, which provides an overview of the docs, it states the following:
In some cases, running executables without bundle exec may work, if the executable happens to be installed in your system and does not pull in any gems that conflict with your bundle.
However, this is unreliable and is the source of considerable pain. Even if it looks like it works, it may not work in the future or on another machine.
I'm guessing that you run gem which rails in your console, and then run bundle show rails in your console, the default installed rails installation for your system differs from the one installed for your bundle.
You say that you are using rvm for your ruby and gem management. I'm thinking you may not have properly configured it. Trying executing the rvm notes command in your console to ensure that you have addressed all of the required/recommended steps for installation on your OS. You want to ensure that the executables for rvm are the first things included in your path when you run echo $PATH ideally. This will ensure that the gems installed for rvm will be the ones executed when you try executing them without prefixing bundle exec. If rvm notes doesn't give you the hints necessary to accomplish that, then try carefully reviewing the docs for installation on the RVM website.
You can switch version between Ruby with $ rvm use --default 2.4.0 for example
But for your problem try this :
$ gem install bundler
$ gem install rails
Hope it helps !
I think below command will work
gem pristine rails
issue => can't find gem rails - Gem::GemNotFoundException
Solution for Mac M1 Chip
Remove Gemfile.lock
run rm Gemfile.lock
run bundle install
run pod update && pod install

Rails, Installed Rails Debugger

Please see below:
$ sudo gem install ruby-debug
Successfully installed ruby-debug-0.10.4
1 gem installed
Installing ri documentation for ruby-debug-0.10.4...
Installing RDoc documentation for ruby-debug-0.10.4...
That all looks great, then when I go to fire up the server, it starts up and then exists:
$ rails server --debugger
=> Booting WEBrick
=> Rails 3.0.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Silencing Postgres
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Exiting
Anyone seen this before?
Thanks
You probably need to put it in the Gemfile, gem 'ruby-debug' and then run bundle install on it. Try that

Resources