Gem:生成新Rails项目时的loaderror

时间:2016-09-23 17:24:18

标签: ruby-on-rails ruby rubygems

我以前使用Rails4并将所有内容更新为Rails5。从那时起,每当我创建一个新的rails项目时,我都会得到gem:loaderror。

我输入rails new sampletest

项目自动安装宝石后,我收到错误消息

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>'

我不知道为什么它会说我应该把“spring”放到gemfile中。

1 个答案:

答案 0 :(得分:1)

好像你有捆绑包配置问题 您可以运行bundle config来查看它的外观。

你的情况

$ 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"
...

所以你有全球设置 您应该通过删除而无需声明来编辑/Users/(folder_name)/.bundle/config 您可以运行bundle config --delete without来执行此操作。

然后您可以再次运行bundle config 在您的特定情况下,您会看到

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

所以你也有本地without设置 再次运行bundle config --delete without将其删除。

现在您已准备好运行bundle install。这次应安装所有宝石。