jpa*_*eri 4 ruby rspec ruby-on-rails bundler
当我尝试在 Rails 5.1 应用程序中运行测试时,出现无法找到可执行文件的错误:
$ bundle exec rspec
bundler: failed to load command: rspec (/Users/joepalmieri/.rbenv/versions/2.3.3/bin/rspec)
Gem::Exception: can't find executable rspec
/Users/joepalmieri/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.14.6/lib/bundler/rubygems_integration.rb:408:in `block in replace_bin_path'
/Users/joepalmieri/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/bundler-1.14.6/lib/bundler/rubygems_integration.rb:434:in `block in replace_bin_path'
/Users/joepalmieri/.rbenv/versions/2.3.3/bin/rspec:22:in `<top (required)>'
Run Code Online (Sandbox Code Playgroud)
但是,当我查看时/Users/joepalmieri/.rbenv/versions/2.3.3/bin,可执行文件在那里:
$ ls /Users/joepalmieri/.rbenv/versions/2.3.3/bin | grep rspec
// => rspec
Run Code Online (Sandbox Code Playgroud)
以下是我的 Gemfile 的相关部分:
gem 'rails', '~> 5.1.4'
group :development, :test do
gem 'rspec-rails', '3.7.2'
end
Run Code Online (Sandbox Code Playgroud)
跑步rbenv rehash没有帮助。
关于我为制造这种疯狂所做的愚蠢事情有什么线索吗?
jpa*_*eri 11
当然,这是显而易见的事情。我曾在bundle install --without development test本地运行以测试某些内容。我没有意识到在那之后运行bundle install(不合格)会重复安装相同的组(即,它不会为development和test组安装 gem )。
跑步bundle install --with development test解决了这个问题。