I tried to run rails s but sudently I'm getting an error message:
/home/leiver/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require': cannot load such file -- sass (LoadError)
from /home/leiver/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
from /home/leiver/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
from
.....
I know that there's something about sass about how it's going to disapear or something and I don't know if it's linked
Thanks if you can help :)
EDIT
here's my full Gemfile:
source 'https://rubygems.org'
ruby '2.4.5'
gem 'bootsnap', require: false
gem 'jbuilder', '~> 2.0'
gem 'pg', '~> 0.21'
gem 'puma'
gem 'rails', '5.2.1'
gem 'redis'
gem 'autoprefixer-rails'
gem 'bootstrap-sass', '~> 3.3'
gem 'font-awesome-sass', '~> 5.0.9'
gem 'sassc-rails'
gem 'simple_form'
gem 'uglifier'
gem 'webpacker'
gem 'devise'
gem 'money-rails'
gem "pundit"
group :development do
gem 'web-console', '>= 3.3.0'
end
group :development, :test do
gem 'pry-byebug'
gem 'pry-rails'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'dotenv-rails'
end
Have tried bundle or bundle install before running the rails s.
Still not working try to replace that gem with thisgem 'sassc' and bundle or just do gem install sassc
Ok so I couldn't resolve the problem, so I deleted my local directory and re-cloned it from GitHub.
I don't know if it's good practice but it resolved the problem for me, so if anyone else is having this issue and don't find a proper solution, try doing that.
The problem may be exists in gems. The problem founded by OP (and described in his answer) appears in the application files. However same problem problem may be caused in gems. The same problem in gems with same reason has identical solution.
In details. The problem during installation or some else may corrupt some gem so it is visible as installed but actually has missed or corrupted files. Check before that hard drive has enough free space.
So solution is fully reinstall bundle gems:
bundle install --force
I deleted all of the files within the tmp folder.
And it worked!
Related
In my Rails app am getting this warning when running guard init rspec:
Warning: you have a Gemfile, but you're not using bundler or
RUBYGEMS_GEMDEPS
14:54:15 - INFO - Writing new Guardfile to
/home/ubuntu/railsprojects/sillyfish/Guardfile 14:54:16 - INFO - rspec
guard added to Guardfile, feel free to edit it
I don't understand why it's showing. Is it okay to ignore this warning?
Here is my Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.2.4'
gem 'pg'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
gem 'rspec-rails', '3.3.3'
gem 'guard-rspec', require: false
gem 'spring-commands-rspec'
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
end
group :test do
gem 'capybara', '2.5.0'
end
#custom gems
gem 'puma'
gem 'bootstrap-sass', '~> 3.3.5'
gem 'devise', '~> 3.5.2'
If you run guard init rspec, it will use the globally installed guard-rails. To run the one installed through your Gemfile, use bundle exec guard init rspec. This is also what is recommended in the documentation.
From the README:
It's important that you always run Guard through Bundler to avoid errors.
So it's probably best to take this warning seriously, to avoid issues down the line.
A more technical answer:
There are 3 ways gems can be selected for your Ruby (or Rails) projects:
As they are installed on your system (by looking at environment variables such as $GEM_HOME), e.g. guard init rspec will look for guard and guard-rspec in your $GEM_HOME. Usually RubyGems will use the latest installed versions you have installed (not always what you'll want).
If you have Bundler, bundle exec guard init rspec will cause your gems to be loaded in versions listed in your Gemfile.lock. This also allows you to load gems directly from other folders (anywhere using :path option in your Gemfile) bundled with the app (e.g. .bundle directory) or even downloaded and updated from GitHub (using :github, :branch, etc. options).
If you have a recent version of RubyGems, it can also load your gems from a Gemfile.lock. But only if you have the $RUBYGEMS_GEMDEPS environment properly set up. It works like Bundler (it reads your Gemfile.lock), except it doesn't have all the features (like loading gems from a GitHub repository).
In general, if your project has a Gemfile, it's best to use Bundler, because it makes sure all the versions of all gems are matched up to what you expect.
I'm trying to run rails g active_admin:install script after installing of activeadmin gem. When I run this script I get an error
Could not find arbre-1.0.1 in any of the sources
Run `bundle install` to install missing gems.
Although I've already installed all necessary gems and my app is using arbre gem:
Using arbre 1.0.1
Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.1.1'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'spring', group: :development
gem 'devise'
gem 'activeadmin', github: 'gregbell/active_admin'
How can I fix that problem? Thanks!
Take a look at https://github.com/gregbell/active_admin/issues/3216. Although the cause of the problem is not mentioned they recommend deleting Gemfile.lock and running bundle install again.
The problem is the wrong gemset for the app. For me solution was rvm use 2.1.1#your_gemset and restarting terminal
I know this question has been answered a million times on SO, but I can't seem to find the right combination of things to fix my dilemma.
This is the error I'm getting:
An error occurred while installing sqlite-ruby (1.2.5), and Bundler cannot continue.
Make sure that 'gem install sqlite3-ruby -v '1.2.5'' succeeds before bundling.
Failed to install gems via bundler.
Detected sqlite gem that is not supported on Heroku
I already have Postgres installed on my laptop, and my Gemfile is as follows:
source 'https://rubygems.org'
gem 'rails', '4.0.3'
gem 'sqlite3-ruby', '1.2.5'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'bootstrap-sass'
group :doc do
gem 'sdoc', require: false
end
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
Anyone have insight on what I'm doing wrong? I already made sure that my changes are committed via "bundle install" and "bundle".
Simply remove the line
gem 'sqlite3-ruby', '1.2.5'
because you already have the gem sqlite in development and test environments, run bundle install, and you should be good to go!
I am building a rails app and was using rails 4.0.1.
I had an error and noticed that it was mentioned as a bug on rails 3 months ago so I decided to: bundle update and got rails 4.0.3
after doing so neither the tests nor the server would start and they throw an error:
gems/railties-4.0.3/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `action_mailer' for # (NoMethodError)
For the moment I commented out the action_mailer lines in the config/environments/* but it would be good to find a real solution.
Searching on Google didn't yield anything regarding this specific error.
Please let me know if I can provide any more detail.
Thank you very much.
UPDATE: here is my Gemfile
source 'https://rubygems.org'
ruby '2.0.0'
gem 'bootstrap-sass'
gem 'bootstrap_form'
gem 'coffee-rails'
gem 'rails'
gem 'haml-rails'
gem 'sass-rails'
gem 'uglifier'
gem 'jquery-rails'
gem 'bcrypt-ruby', '~> 3.1.2'
group :development do
gem 'sqlite3'
gem 'thin'
# gem "better_errors"
gem "binding_of_caller"
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
group :development, :test do
gem 'rspec-rails'
gem 'pry'
gem 'pry-nav'
end
group :test do
gem "faker"
gem "capybara"
gem "database_cleaner"
gem "launchy"
gem 'shoulda-matchers'
gem "selenium-webdriver"
gem "fivemat"
gem 'fabrication'
end
Solution found, in case anyone lands here:
The main issue was that in my Gemfile as you can see no specific gem version was set (apart from bcrypt)
Somehow this makes bundle installs outdated versions under circumstances that are not yet clear to me.
Steps to fix:
completely remove the gemset (if you are using one) or uninstall all
gems
remove the Gemfile.lock
specifiy what version of rails you need e.g. 'rails', '~> 4.0.3'
bundle install
you are set :)
in my case I had installed the gems and since the devkit was not installed properly the gems did not compile.
After setting up the devkit I had to uninstall all of the rails gems (actionmailer, activerecord, actioncable......) and then install rails again.
Then it worked.
I am developing a rails application in Mac after switching over from Windows. I thought that I had installed everything correctly. The IDE I'm using is Rubymine.
I receive numerous error messages when the rake command is run at the start of a new application. The cause is:
/Users/johncase/.gem/ruby/2.0.0/gems/bundler-1.5.1/lib/bundler/resolver.rb:302:in `resolve': Could not find gem 'sdoc (>= 0) ruby' in the gems available on this machine. (Bundler::GemNotFound)
I have installed sdoc multiple times through different methods, but I keep receiving the error. I have researched this problem and found many answers that have not worked.
I've tried: 'http://rubygems.org' instead of 'https://rubygems.org' then a bundle install with no success.
I've tried deleting the Gemfile.lock then bundle installing with no success.
Perhaps the answer is obvious, but I cannot seem to find it. Any assistance with this problem would be much appreciated.
Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.0.2'
gem 'mysql2'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
gem 'sdoc', require: false
end
This is because the gem is installed, but not being required. You either need to remove the require: false in the Gemfile or require it manually in your rake task. There is a lengthy explanation of this here: Bundler: What does :require => false in a Gemfile mean?