在现有的Rails项目上,我在设置环境时遇到了一些困难,这使臭名昭著的“依赖地狱”浮现在脑海。似乎仅限于mini_racer 0.2.4。
这里是怎么回事:
bundle install
# […] lot of working stuffs
Fetching libv8 6.7.288.46.1 (x86_64-linux)
Installing libv8 6.7.288.46.1 (x86_64-linux)
# […] more working stuffs
Fetching mini_racer 0.2.4
Installing mini_racer 0.2.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/psychoslave/.rvm/gems/ruby-2.5.1@the_project/gems/mini_racer-0.2.4/ext/mini_racer_extension
/home/psychoslave/.rvm/rubies/ruby-2.5.1/bin/ruby -I /home/psychoslave/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0 -r ./siteconf20200404-68221-1tr6jr3.rb extconf.rb
checking for -lpthread... yes
creating Makefile
current directory: /home/psychoslave/.rvm/gems/ruby-2.5.1@the_project/gems/mini_racer-0.2.4/ext/mini_racer_extension
make "DESTDIR=" clean
current directory: /home/psychoslave/.rvm/gems/ruby-2.5.1@the_project/gems/mini_racer-0.2.4/ext/mini_racer_extension
make "DESTDIR="
compiling mini_racer_extension.cc
cc1plus: warning: command line option '-Wimplicit-int' is valid for C/ObjC but not for C++
mini_racer_extension.cc: In function 'void prepare_result(v8::MaybeLocal<v8::Value>, v8::TryCatch&, v8::Isolate*, v8::Local<v8::Context>, EvalResult&)':
mini_racer_extension.cc:234:73: error: no matching function for call to 'v8::Value::ToObject()'
234 | String::NewFromUtf8(isolate, "JSON"))->ToObject();
| ^
In file included from mini_racer_extension.cc:4:
/home/psychoslave/.rvm/gems/ruby-2.5.1@the_project/gems/libv8-7.3.492.27.1-x86_64-linux/vendor/v8/include/v8.h:2390:44: note: candidate: 'v8::MaybeLocal<v8::Object>
v8::Value::ToObject(v8::Local<v8::Context>) const'
2390 | V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
| ^~~~~~~~
[…]
[A lot of other compiling errors]
[…]
At global scope:
cc1plus: warning: unrecognized command line option '-Wno-self-assign'
cc1plus: warning: unrecognized command line option '-Wno-constant-logical-operand'
cc1plus: warning: unrecognized command line option '-Wno-parentheses-equality'
make: *** [Makefile:210: mini_racer_extension.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/psychoslave/.rvm/gems/ruby-2.5.1@the_project/gems/mini_racer-0.2.4 for inspection.
Results logged to /home/psychoslave/.rvm/gems/ruby-2.5.1@the_project/extensions/x86_64-linux/2.5.0/mini_racer-0.2.4/gem_make.out
An error occurred while installing mini_racer (0.2.4), and Bundler cannot continue.
Make sure that `gem install mini_racer -v '0.2.4' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
mini_racer
浏览网页,很容易找到导致mini-racer failing to compile · Issue #4 · jules2689/extended_bundler-errors的Add mini_racer handling。由此,我尝试了gem uninstall libv8 && gem install mini_racer -v '0.2.4' --source 'https://rubygems.org/
,但无法像上面那样编译。
现在,运行bundle update && bundle install
就像是一种魅力,所以我想我现在就可以继续使用它,与团队的其他成员一起看看是否可以更新至少迷你赛车的宝石。然后,我开始完成README.md,以添加一些详细信息,并希望提交到新的分支并要求复审。但是碰巧团队使用过量提交添加了一些git钩子,这些钩子正在崩溃,因为它包括依赖mini_racer-0.2.4的Brakeman:
git commit -m"Add more detailed procedure on how to install on Fedora 31"
Running pre-commit hooks
Analyze with RailsBestPractices..................[RailsBestPractices] OK
Check for vulnerable versions of gems...................[BundleAudit] WARNING
Run Brakeman...............................................[Brakeman] FAILED
/home/psychoslave/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler/spec_set.rb:91:in `block in materialize': Could not find mini_racer-0.2.4 in any of the sources (Bundler::GemNotFound)
from /home/psychoslave/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler/spec_set.rb:85:in `map!'
from /home/psychoslave/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler/spec_set.rb:85:in `materialize'
from /home/psychoslave/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler/definition.rb:170:in `specs'
from /home/psychoslave/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler/definition.rb:237:in `specs_for'
from /home/psychoslave/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler/definition.rb:226:in `requested_specs'
from /home/psychoslave/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:108:in `block in definition_method'
from /home/psychoslave/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:20:in `setup'
from /home/psychoslave/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler.rb:107:in `setup'
from /home/psychoslave/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/bundler/setup.rb:20:in `<top (required)>'
from /home/psychoslave/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/psychoslave/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'
Run YarnLint...............................................[YarnLint] OK
✗ One or more pre-commit hooks failed
开发平台摘要:
您将建议采取哪些步骤来解决此依赖性问题?
对于它的价值,我们的团队只是运行了bundle update mini_racer
,现在一切正常。当然,它仍然无法在Fedora 31上编译mini_racer 0.2.4。