繁体   English   中英

新建Rails项目时出现Gem:loaderror

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

我曾经使用过Rails4,并将所有内容更新为Rails5。 从那时起,每当我创建一个新的Rails项目时,我就会得到gem:loaderror。

我输入rails new sampletest

项目自动安装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>'

我不确定为什么它说我应该在gemfile中放“ spring”到它。

似乎您在捆绑程序配置方面遇到了问题。
您可以运行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 这次应安装所有宝石。

暂无
暂无

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

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