In development I'm running guard with liveReload. To make it run I had to add this lines to config.ru file:
require 'rack-livereload'
use Rack::LiveReload
before the line run Habrablog::Application. Without these lines LiveReload doesn't work for me.
The gems guard-livereload and rack-livereload are in the develpment group of Gemfile.
But when i'm pushing to heroku server i've got a message:
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-
3.2.2/lib/active_support/dependencies.rb:251:in `require':
no such file to load -- rack-livereload (LoadError)
Obviously it's because of livereload, how to eliminate the livereload configuration from production?
I don't think you need to add anything to your config.ru file (that's just for Sinatra).
Neither of the gem install guides mention this for Rails, the rack-reload settings go in config/environments/development.rb
https://github.com/guard/guard-livereload/
https://github.com/johnbintz/rack-livereload/
Related
Any rails command doesn't work for me. I have several versions of ruby installed through rvm. I tried installing rails with all the versions, they do install successfully but with all of them I face the following error whenever I run any rails command in my project directory:
~ rails new blog
Traceback (most recent call last):
1: from bin/rails:3:in `<main>'
bin/rails:3:in `require_relative': cannot load such file -- /Users/Am33d/Documents/config/boot (LoadError)
I tried looking up for the error but didn't find any solutions.
What can be done to fix this? I am using macOS Mojave (10.14.6)
This error would indicate that you do not have a boot.rb file in your config directory for some reason. When running rails commands -- regardless of if you run them as bin/rails [command] or bundle exec rails [command], runs the bin/rails file. This file typically has a line require_relative '../config/boot. The boilerplate bin/rails file in a new Rails 6 app is:
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
To simply fix this you can create a blank file by running touch config/boot.rb from the root directory of your application and that would itself suppress the error. Having said that, you'd be better off creating a config/boot.rb file that contains useful information. The boilerplate config/boot.rb file is this
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
Without this file you are not necessarily appropriately loading the gems from your gemfile or caching operations with bootsnap.
When I ran into this problem, I also received the same error when trying to use rails -s.
If the same is happening for you, its because your version of ruby isn't compatible with your rails version.
After upgrading to the latest rails version the error stopped and everything worked well.
A little bit weird.
rails new blog should not need to find boot file, neither need bundler. Actually, you are trying to create a new project, so it is expected there is not Gemfile, boot, or bundler created for your project.
So I would advise you to find what rails command is being executed. Sometimes one rails executable created by bundler is taking precedence in the $PATH environment variable.
Ex: some incorrect bin/rails executable is on your $HOME directory.
i was trying to build an app using 'rails server' and this error was showing. You have to make sure that the rails version matches the ruby version and even if you do what an answer above said (create the config/boot.rb paste) doesnt work, than you have to change the version of rails to the stable. I'll let the link of this problem here, there's an issue closed in github for this problem https://github.com/rails/rails/pull/43951
to solve the problem you have to replace the gem rails line on the gemfile to this:
gem "rails", github: "rails/rails", branch: "7-0-stable"
Sorry about my english.
I'm trying to run a script, which has a line:
require 'headless'
There are several other gems that are working perfect in the same script, here's httpd error log:
:/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:128:in `require'
:cannot load such file -- headless
What is wrong here? I can see that I'm missing something, under
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/ there is no core_ext directory.
I'm just trying to move some scripts from an old server to a new server.
Put gem "headless" in your Gemfile and run bundle install
I'm trying to setup an application on a ubuntu VPS with rvm installed. The thin webserver works fine, but all the rake commands fails with same error message.
LoadError: cannot load such file -- cucumber/rake/task
I've this on my Rakefile:
require 'cucumber/rake/task'
I've tried with
gem install cucumber
gem install guard-cucumber
gem install cucumber-rails
gem install rake
bundle exec rake db:migrate
Nothing seems to work
#which ruby
/home/ubuntu/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
#which rake
/home/ubuntu/.rvm/gems/ruby-2.0.0-p353#search-demo/bin/rake
What else could be or how I can debug this?
You can check the load path printing the $: var. check if you have the cucumber gem there and if it match the version that you have on your local machine, where I suppose is working.
If the gem path is not there, be sure it is installed with
gem list | grep cucu
Also compare versions with your local environment.
Check your Gemfile, make sure you dont have those gems on a group :development block or similar, cause you have probably set RAILS_ENV in your vps to production.
I just ran bundle update and capistrano got updated to 3.0.0 but now when I run cap deploy I get an error and can't figure out how to fix this. I have been updating my server every day without problem until this update.
cap aborted!
cannot load such file -- deploy
/home/mark/rails_apps/myapp/Capfile:1:in `load'
/home/mark/rails_apps/myapp/Capfile:1:in `<top (required)>'
capfile
load 'deploy'
load 'deploy/assets'
load 'config/deploy' # remove this line to skip loading any of the default tasks
I had to gem uninstall capistrano and selected version 3.0.0
(i.e. downgraded the gem to 2.x)
I had to run
gem uninstall capistrano
then update the gemfile with
gem 'capistrano', '~> 2.15'
and then run to reinstall the correct version again with
bundle update capistrano
Make sure you are using bundle exec (most likely you have multiple gem versions of capistrano)
i.e.
bundle exec cap -T
Instead of downgrading to Capistrano 2 use the new configuration from the current version.
require "capistrano/bundler"
require "capistrano/rails/assets"
require "capistrano/rails/migrations"
See also this nice posting, which summarises the differences between Capistrano 2 and 3.
Add the related gems to your Gemfile
i.e. for
gem 'capistrano-bundler' # for capistrano/bundler
gem 'capistrano-rails' # for capistrano/rails/*
Do not downgrade to 2.x for this.
I had this problem today and pastullo's solution above fixed it except that I had to run gem uninstall capistrano (as markhorrocks answered) not bundle uninstall capistrano.
I also found this blog on bundler very useful: http://viget.com/extend/bundler-best-practices
Thanks for sharing this as it saved me heaps of time. x
The fastest way to fix this I have found is to backup the cap files (Capfile, config/deploy.rb, and config/deploy/*.rb) and then re capify (it's no longer called "capify"):
bundle exec cap install STAGES=staging,production
Then recreate your cap files from your backup. It will take you 5 minutes to do this and you'll be over the major Capistrano upgrade hump.
I used
bundle exec cap production deploy
instead of just cap production deploy
in my case I have changed my project ruby version. may be bundle also work here.
but I changed it to back what it was in previously.
ex:
rbenv local 2.4.1
I've recently updated a rails 2.3.10 application to rails 3.0.5. I followed the rails-upgrade gem instructions. Running bundle install works fine. I've update the boot.rb application.rb and environment.rb.
$ bundle install
Using rake (0.8.7)
...
Using railties (3.0.5)
Using rails (3.0.5)
...
However, when I call 'rails server' I still get usage instructions:
$ rails server
Usage:
rails new APP_PATH [options]
Anyone have any ideas why this is happening? I suspect an error is getting swallowed somewhere from the upgrade procedure, but I'm not sure where to look.
I just figured out a way to fix this, so I thought I'd add the step for everyone else to follow.
After doing the rails-upgrade steps:
rake rails:upgrade:check
rake rails:upgrade:backup
build a new rails app over the existing one, by doing the following WITHIN the app's directory.
rails_2_app $ rails new .
And then continue the upgrade as normal.
You need to delete all the existing files under script folder and to create a file called rails under the same folder. The rails file should contain the following:
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
that's all you are good to do. You will have all the commands.