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?
Related
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!
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.
Active admin gem is added to my rails project but every time i tried to install rails g active_admin:install, I am getting error like
git://github.com/activeadmin/activeadmin.git (at master) is not yet
checked out. Run bundle install first.
I definitely ran bundle before running "rails g active_admin:install". After running "bundle show" i am seeing i have " * activeadmin (1.0.0.pre 3f916d6)" added to my project but keep getting this error message.My gem file below
source 'https://rubygems.org'
gem 'rails', '4.1.8'
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: 'activeadmin'
I had the same issue. It is something to do with spring as when I removed it from the gemfile and run bundle install again, I was able to run rails g active_admin:install
Instead of removing spring you could also try this tip from the spring github issue:
Try running bundle exec spring binstub --all - it should regenerate your bin/spring file
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!