亲爱的
我在让Redmine重新工作时遇到了红宝石的问题。基本上,这是在以前以某种方式进行的,但是现在在进行某些操作之后,我无法真正找到执行并弄乱事情的人,该系统不再起作用。我已经解决了其他一些问题,但是这个mysql2问题使我的技能无法适应:
-------- The exception is as follows: -------
Could not find mysql2-0.3.21 in any of the sources (Bundler::GemNotFound)
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.16.5/lib/bundler/spec_set.rb:91:in `block in materialize'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.16.5/lib/bundler/spec_set.rb:85:in `map!'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.16.5/lib/bundler/spec_set.rb:85:in `materialize'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.16.5/lib/bundler/definition.rb:171:in `specs'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.16.5/lib/bundler/definition.rb:238:in `specs_for'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.16.5/lib/bundler/definition.rb:227:in `requested_specs'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:108:in `block in definition_method'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:20:in `setup'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.16.5/lib/bundler.rb:107:in `setup'
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.16.5/lib/bundler/setup.rb:20:in `<top (required)>'
/usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.1.5/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:430:in `activate_gem'
/usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.1.5/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:297:in `block in run_load_path_setup_code'
/usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.1.5/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:435:in `running_bundler'
/usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.1.5/src/ruby_supportlib/phusion_passenger/loader_shared_helpers.rb:296:in `run_load_path_setup_code'
/usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.1.5/src/helper-scripts/rack-preloader.rb:100:in `preload_app'
/usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.1.5/src/helper-scripts/rack-preloader.rb:156:in `<module:App>'
/usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.1.5/src/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
/usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.1.5/src/helper-scripts/rack-preloader.rb:29:in `<main>'
我已经安装了mysql2 gem和要求的特定版本:
# ls -lah /usr/local/lib/ruby/gems/2.4.0/gems/mysql2-0.3.21
total 52K
drwxr-xr-x. 7 root root 4.0K Jun 27 2017 .
drwxr-xr-x. 97 root root 4.0K Jun 28 2017 ..
-rw-r--r--. 1 root root 1.1K Jun 27 2017 LICENSE
-rw-r--r--. 1 root root 20K Jun 27 2017 README.md
drwxr-xr-x. 2 root root 4.0K Jun 27 2017 examples
drwxr-xr-x. 3 root root 4.0K Jun 27 2017 ext
drwxr-xr-x. 3 root root 4.0K Jun 27 2017 lib
drwxr-xr-x. 4 root root 4.0K Jun 27 2017 spec
drwxr-xr-x. 2 root root 4.0K Jun 27 2017 support
对我来说一切都很好:
# ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
宝石:
# gem list
*** LOCAL GEMS ***
actionmailer (4.2.7.1, 3.2.14)
actionpack (4.2.7.1, 3.2.14)
actionpack-action_caching (1.2.0, 1.1.1)
actionpack-xml_parser (1.0.2)
actionview (4.2.7.1)
activejob (4.2.7.1)
activemodel (4.2.7.1, 3.2.14)
activerecord (4.2.7.1, 3.2.14)
activeresource (3.2.14)
activesupport (4.2.7.1, 3.2.14)
addressable (2.5.2, 2.5.1, 2.5.0)
afm (0.2.0)
arel (6.0.4, 6.0.3, 3.0.3, 3.0.2)
Ascii85 (1.0.2)
authlogic (3.8.0, 3.3.0)
bigdecimal (default: 1.2.6)
blitz (0.1.30)
bootstrap-sass (2.3.2.2)
builder (3.2.3, 3.2.2, 3.0.4)
bundler (1.16.5, default: 1.16.2, 1.15.1)
cancan (1.6.10)
capybara (2.14.4, 2.1.0)
childprocess (0.7.1)
chosen-rails (1.0.0)
chunky_png (1.2.8)
cocaine (0.3.2)
coderay (1.1.1)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.3)
commonjs (0.2.6)
compass (0.12.2)
compass-rails (1.0.3)
concurrent-ruby (1.0.5, 1.0.4)
couchrest (1.0.1)
css_parser (1.5.0, 1.4.7)
diff-lcs (1.2.4)
docile (1.1.5)
erubis (2.7.0)
execjs (1.4.0)
expectr (0.9.1)
factory_girl (4.2.0)
factory_girl_rails (4.2.1)
faraday (0.9.0)
fcgi (0.9.2.1)
ffi (1.9.25, 1.9.18)
ffi-compiler (1.0.1)
fssm (0.2.10)
globalid (0.4.0, 0.3.7)
hashery (2.1.0)
hashie (1.2.0)
hexdump (0.2.3)
hike (1.2.3)
htmlentities (4.3.4, 4.3.1)
httpauth (0.2.1)
i18n (0.9.5, 0.8.4, 0.7.0, 0.6.5)
io-console (default: 0.4.3)
journey (1.0.4)
jquery-rails (3.1.4, 3.0.4)
jquery-ui-rails (4.0.4)
json (2.1.0, 1.8.6, 1.8.3, default: 1.8.1)
json_pure (1.8.0)
jwt (0.1.13)
kaminari (0.14.1)
kgio (2.9.2)
less (2.3.2)
less-rails (2.3.3)
libv8 (3.11.8.17 x86_64-linux)
loofah (2.0.3)
mail (2.6.6, 2.6.4, 2.5.5, 2.5.4)
metaclass (0.0.4)
mime-types (3.1, 1.25.1, 1.24)
mime-types-data (3.2016.0521)
mimemagic (0.3.2)
mini_portile (0.5.1)
mini_portile2 (2.2.0, 2.1.0)
minitest (5.10.2, 5.10.1, 5.4.3)
mocha (1.2.1)
multi_json (1.13.1, 1.12.1, 1.7.9)
multipart-post (2.0.0)
mysql (2.9.1)
net-ldap (0.12.1)
nokogiri (1.8.0, 1.6.8.1, 1.6.0)
passenger (5.3.4)
polyglot (0.3.5, 0.3.3)
power_assert (0.2.2)
protected_attributes (1.1.4, 1.1.3)
psych (default: 2.0.8)
public_suffix (3.0.3, 2.0.5, 2.0.4)
rack (1.6.8, 1.6.5, 1.4.7, 1.4.5)
rack-cache (1.8.0, 1.2)
rack-openid (1.4.2)
rack-ssl (1.3.3)
rack-test (0.6.3, 0.6.2)
rails (4.2.7.1)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.8, 1.0.7)
rails-html-sanitizer (1.0.3)
railties (4.2.7.1, 3.2.14)
rake (12.3.1, 12.0.0, default: 10.4.2, 10.1.0)
rbpdf (1.19.2, 1.19.0)
rbpdf-font (1.19.1, 1.19.0)
rdoc (5.1.0, default: 4.2.0, 3.12.2)
redcarpet (3.3.4)
request_store (1.4.1, 1.0.5)
rest-client (1.6.7)
rmagick (2.16.0)
roadie (3.2.2, 3.2.0)
roadie-rails (1.2.1, 1.1.1)
ruby-openid (2.3.0)
rubygems-update (2.7.7)
rubyzip (1.2.1)
sass (3.2.10)
sass-rails (3.2.6)
scrypt (3.0.5)
selenium-webdriver (3.4.3)
simplecov (0.9.2)
simplecov-html (0.9.0)
sprockets (3.7.1, 2.2.3, 2.2.2)
sprockets-rails (3.2.0)
term-ansicolor (1.0.5)
test-unit (3.0.8)
thor (0.19.4, 0.18.1)
thread_safe (0.3.6, 0.3.5)
tilt (1.4.1)
treetop (1.4.15)
tzinfo (1.2.3, 1.2.2, 0.3.54, 0.3.37)
xpath (2.1.0, 2.0.0)
yard (0.9.9)
为什么会这样?
答案 0 :(得分:1)
您的安装看起来很乱。看看:
调用堆栈显示了来自不同Ruby版本(2.2和2.4)的宝石:
{
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"jsx": "react",
"strict": true,
"typeRoots": ["./types", "./node_modules/@types"],
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
},
"exclude": ["node_modules", "typings"]
}
为Ruby 2.4安装了 [ts] Could not find a declaration file for module '../actions'
gem:
/usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.16.5
...
/usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.1.5
但是您当前的Ruby版本是2.2(正确的Mysql2
)。对于此版本,/usr/local/lib/ruby/gems/2.4.0/gems/mysql2-0.3.21
中没有gem;仅2.2.4p230
可用:
mysql2
我建议卸载不与宝石一起使用的红宝石,保留一个自己喜欢的宝石,对于该版本,请从头开始安装所有必需的宝石。或者,最好将mysql
或其他Ruby管理器与宝石集一起使用。