【发布时间】:2021-05-24 14:18:16
【问题描述】:
我在 docker 上运行一个 rails 应用程序,我现在想启用 rubocop,但是当我尝试启用时,我得到了以下信息。
Error:bundler: failed to load command: rubocop
(/Users/name/.rbenv/versions/3.0.1/bin/rubocop)
/Users/name/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/spec_set.rb:41:in `block in for':
Unable to find a spec satisfying nokogiri (>= 1.8.5) in the set. Perhaps the lockfile is
corrupted? Found nokogiri (1.11.4-x86_64-linux) that did not match the current platform.
在容器内我得到以下内容
ruby -v
ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux]
which bundler
/usr/local/bundle/bin/bundler
在我机器上的容器外
ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
which bundler
/usr/bin/bundler
据我了解,rubocop 在容器安装的 gem 上查找 nokogiri,因此找不到正确的版本,我可以安装另一个 nokogiri gem 以从容器外部的 rubocop 使用吗?
【问题讨论】:
标签: ruby-on-rails docker rubocop