[英]$GEM is not part of the bundle. Add it to Gemfile
Suddenly I can't run rspec or guard anymore. 突然我不能再运行rspec或守护了。 I even did a checkout on an old commit where I know I had some tests running.
我什至对一个旧提交进行了检出,我知道我正在运行一些测试。 Same error there.
那里同样的错误。
$ git checkout known-working-commit && bundle && rspec spec
.../ruby-2.2.3@solidus/gems/bundler-1.11.2/lib/bundler/rubygems_integration.rb:304:in
`block in replace_gem': rspec-core is not part of the bundle.
Add it to Gemfile. (Gem::LoadError)
I get the same error if I run rspec
and guard
. 如果我运行
rspec
和guard
则会遇到相同的错误。 Having a look at the PATH exposed by rvm info
, I see that guard is available at /Users/martins/.rvm/gems/ruby-2.2.3@solidus/bin/guard
. 看一下
rvm info
公开的PATH,我发现可以在/Users/martins/.rvm/gems/ruby-2.2.3@solidus/bin/guard
上找到/Users/martins/.rvm/gems/ruby-2.2.3@solidus/bin/guard
。 $PATH also has /Users/martins/.rvm/gems/ruby-2.2.3@solidus/bin
as it's first entry. $ PATH的第一个条目也包含
/Users/martins/.rvm/gems/ruby-2.2.3@solidus/bin
。 Any idea what might have gone wrong? 知道可能出了什么问题吗? I thought that by having a directory listed first in PATH would give it precedence over the other directories listed.
我认为,通过在PATH中首先列出目录,可以使其优先于列出的其他目录。 How come I get the
"bundler-1.11.2/lib/bundler/rubygems_integration.rb:304:in block in replace_gem': rspec-core is not part of the bundle. Add it to Gemfile"
error? 我怎么会收到
"bundler-1.11.2/lib/bundler/rubygems_integration.rb:304:in block in replace_gem': rspec-core is not part of the bundle. Add it to Gemfile"
错误?
I'm running OS X 10.10.5 and ZSH. 我正在运行OS X 10.10.5和ZSH。
My test section from Gemfile 我来自Gemfile的测试部分
19 group :test do
20 gem 'factory_girl_rails', '~> 4.5.0'
21 gem 'capybara', '~> 2.4'
22 gem 'capybara-screenshot'
23 gem 'database_cleaner', '~> 1.3'
24 gem 'email_spec'
25 gem 'launchy'
26 gem 'rspec-activemodel-mocks', '~>1.0.2'
27 gem 'rspec-collection_matchers'
28 gem 'rspec-its'
29 gem 'rspec-rails', '~> 3.3.0'
30 gem 'simplecov'
31 gem 'webmock', '1.8.11'
32 gem 'poltergeist'
33 gem 'timecop'
34 gem 'with_model'
35 gem 'rspec_junit_formatter'
36 end
The same branch works as expect on my work computer. 同一分支在我的工作计算机上可以正常工作。 Which makes me think there is some environment settings that are messing things up.
这让我认为有些环境设置使事情变得混乱。
Just having the gem
either in the PATH
or GEM_PATH
is not enough. 仅将
gem
放在PATH
或GEM_PATH
是不够的。 Your application needs to require
it. 你的应用程序需要
require
它。 Adding it to the Gemfile
and bundling it ensures that the bundler
requires it for you. 将其添加到
Gemfile
并将其捆绑在一起可确保bundler
程序对您有帮助。
Ensure that the rspec
or rspec-rails
(if rails based application) is included in your Gemfile
. 确保
Gemfile
包含rspec
或rspec-rails
(如果基于rails的应用程序)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.