简体   繁体   English

新建Rails项目时出现Gem:loaderror

[英]Gem:loaderror when the new Rails project is made

I used to use Rails4 and updated everything to Rails5. 我曾经使用过Rails4,并将所有内容更新为Rails5。 Since then, I've been getting gem:loaderror whenever i make a new rails project. 从那时起,每当我创建一个新的Rails项目时,我就会得到gem:loaderror。

I type rails new sampletest . 我输入rails new sampletest

After the project automatically installs gems, I get an error saying, 项目自动安装gems后,我收到一条错误消息,

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. 我不确定为什么它说我应该在gemfile中放“ spring”到它。

Seems like you have problems with bundler config. 似乎您在捆绑程序配置方面遇到了问题。
You can run bundle config to see what it looks like. 您可以运行bundle config来查看其外观。

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. 您应该通过删除无声明来编辑/Users/(folder_name)/.bundle/config
You can run bundle config --delete without to do it. 您可以不运行bundle config --delete without运行它。

Then you can run bundle config once again. 然后,您可以再次运行bundle config
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. 因此,您也可以without设置本地设置。
Remove it by running bundle config --delete without once again. 通过再次运行bundle config --delete without将其删除。

Now you are ready to run bundle install . 现在您可以运行bundle install All gems should be installed this time. 这次应安装所有宝石。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM