JoHksi JoHksi - 2 months ago 11
Ruby Question

Gem:loaderror when the new Rails project is made

I used to use Rails4 and updated everything to Rails5. Since then, I've been getting gem:loaderror whenever i make a new rails project.

I type

rails new sampletest
.

After the project automatically installs gems, I get an error saying,

Bundle complete! 15 Gemfile dependencies, 54 gems now installed.
Gems in the groups development and test were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
run bundle exec spring binstub --all
/Users/(folder)/.rvm/gems/ruby-2.3.0/gems/bundler-1.12.5/lib/bundler/rubygems_integration.rb:322:in `block in replace_gem': spring is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /Users/(folder)/.rvm/gems/ruby-2.3.0/bin/spring:22:in `<main>'
from /Users/(folder)/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/(folder)/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'


I'm not sure why it is saying I should put "spring" to the gemfile when it is there.

Answer

Seems like you have problems with bundler config.
You can run bundle config to see what it looks like.

It your case you have

$ bundle config
Settings are listed in order of priority. The top value will be used.
without
Set for the current user (/Users/(folder_name)/.bundle/config): "development test"
...

So you have global setting.
You should edit /Users/(folder_name)/.bundle/config by removing without statement.
You can run bundle config --delete without to do it.

Then you can run bundle config once again.
In your particular case you see

Set for your local app (/home/aleksey/projects/mercury/.bundle/config): "development test"
...

So you have local without setting too.
Remove it by running bundle config --delete without once again.

Now you are ready to run bundle install. All gems should be installed this time.