Bundler 找不到 rspec 可执行文件
Bundler can't find rspec executable
当我尝试在我的 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)>'
但是,当我查看 /Users/joepalmieri/.rbenv/versions/2.3.3/bin
时,可执行文件就在那里:
$ ls /Users/joepalmieri/.rbenv/versions/2.3.3/bin | grep rspec
// => rspec
以下是我的 Gemfile 的相关部分:
gem 'rails', '~> 5.1.4'
group :development, :test do
gem 'rspec-rails', '3.7.2'
end
运行 rbenv rehash
没有帮助。
关于我造成这种疯狂的蠢事有什么线索吗?
当然这是显而易见的事情。我在本地有 运行 bundle install --without development test
来测试一些东西。我没有意识到 运行ning bundle install
(不合格)之后会重复安装相同的组(即,它不会安装 development
和 test
组)。
运行 bundle install --with development test
修复了这个问题。
当我尝试在我的 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)>'
但是,当我查看 /Users/joepalmieri/.rbenv/versions/2.3.3/bin
时,可执行文件就在那里:
$ ls /Users/joepalmieri/.rbenv/versions/2.3.3/bin | grep rspec
// => rspec
以下是我的 Gemfile 的相关部分:
gem 'rails', '~> 5.1.4'
group :development, :test do
gem 'rspec-rails', '3.7.2'
end
运行 rbenv rehash
没有帮助。
关于我造成这种疯狂的蠢事有什么线索吗?
当然这是显而易见的事情。我在本地有 运行 bundle install --without development test
来测试一些东西。我没有意识到 运行ning bundle install
(不合格)之后会重复安装相同的组(即,它不会安装 development
和 test
组)。
运行 bundle install --with development test
修复了这个问题。