耙子流产了! LoadError:无法加载此类文件

时间:2015-06-27 19:23:15

标签: ruby rake bundler rbenv

我完全是这个rails框架工作的新手,并通过在线教程学习。我正在使用rails(rails + Mysql)开发一个简单的应用程序。

目前我正面临着" rake"命令。

当我试图" rake db:schema:dump"以下错误即将到来。请给我一些建议。

提前致谢。

harsha@Trebuchet:~/simp_cms$ rake db:schema:dump --trace
rake aborted!
LoadError: cannot load such file -- bundler/setup
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/harsha/simp_cms/config/boot.rb:3:in `<top (required)>'
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/harsha/simp_cms/config/application.rb:1:in `<top (required)>'
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/harsha/simp_cms/Rakefile:4:in `<top (required)>'
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/rake_module.rb:28:in `load'
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/rake_module.rb:28:in `load_rakefile'
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:689:in `raw_load_rakefile'
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:94:in `block in load_rakefile'
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:93:in `load_rakefile'
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:77:in `block in run'
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rake/application.rb:75:in `run'
/home/harsha/.rbenv/versions/2.2.2/bin/rake:33:in `<main>'

harsha@Trebuchet:~/simp_cms$ bundle exec rake db:schema:dump --trace
/var/lib/gems/1.9.1/gems/bundler-1.10.5/lib/bundler/shared_helpers.rb:78: warning: Insecure world writable dir /usr in PATH, mode 040777
Could not find debugger-1.6.8 in any of the sources
Run `bundle install` to install missing gems.

harsha@Trebuchet:~/simp_cms$ gem install debugger -v 1.6.8
Building native extensions.  This could take a while...
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /usr in PATH, mode 040777
ERROR:  Error installing debugger:
    ERROR: Failed to build gem native extension.

    /home/harsha/.rbenv/versions/2.2.2/bin/ruby -r ./siteconf20150628-11403-1nydzd5.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

我的Ruby版本,rails版本和gem列表

harsha@Trebuchet:~$ rails -v
Rails 4.2.2
harsha@Trebuchet:~$ rails -v
Rails 4.2.2
harsha@Trebuchet:~$ gem list

*** LOCAL GEMS ***

actionmailer (4.2.2)
actionpack (4.2.2)
actionview (4.2.2)
activejob (4.2.2)
activemodel (4.2.2)
activerecord (4.2.2)
activesupport (4.2.2)
arel (6.0.0)
bigdecimal (1.2.7, 1.2.6)
binding_of_caller (0.7.2)
builder (3.2.2)
columnize (0.9.0)
debug_inspector (0.0.2)
debugger-linecache (1.2.0)
debugger-ruby_core_source (1.3.8)
erubis (2.7.0)
globalid (0.3.5)
i18n (0.7.0)
io-console (0.4.3)
json (1.8.3, 1.8.1)
loofah (2.0.2)
mail (2.6.3)
mime-types (2.6.1)
mini_portile (0.6.2)
minitest (5.7.0, 5.4.3)
mysql2 (0.3.18)
nokogiri (1.6.6.2)
power_assert (0.2.3, 0.2.2)
psych (2.0.13, 2.0.8)
rack (1.6.4)
rack-test (0.6.3)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.6)
rails-html-sanitizer (1.0.2)
rake (10.4.2)
rdoc (4.2.0)
spring (1.3.6)
test-unit (3.1.2, 3.0.8)
thread_safe (0.3.5)
tzinfo (1.2.2) 

请找到我的database.yml文件

  default: &default
  adapter: mysql2
  encoding: utf8
  pool: 5
  username: simp_cms
  password: secretpassword
  socket: /tmp/mysql.sock

development:
  <<: *default
  database: simp_cms_development

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  <<: *default
  database: simp_cms_test 

请随时与我联系以获取更多详细信息......

更新1: 安装捆绑包并运行&#34;捆绑安装&#34;

harsha@Trebuchet:~/simp_cms$ gem install bundler
Successfully installed bundler-1.10.5
Parsing documentation for bundler-1.10.5
Done installing documentation for bundler after 5 seconds
1 gem installed
harsha@Trebuchet:~/simp_cms$ gem list

*** LOCAL GEMS ***

actionmailer (4.2.2)
actionpack (4.2.2)
actionview (4.2.2)
activejob (4.2.2)
activemodel (4.2.2)
activerecord (4.2.2)
activesupport (4.2.2)
arel (6.0.0)
bigdecimal (1.2.7, 1.2.6)
binding_of_caller (0.7.2)
builder (3.2.2)
bundler (1.10.5)
columnize (0.9.0)
debug_inspector (0.0.2)
debugger-linecache (1.2.0)
debugger-ruby_core_source (1.3.8)
erubis (2.7.0)
globalid (0.3.5)
i18n (0.7.0)
io-console (0.4.3)
json (1.8.3, 1.8.1)
loofah (2.0.2)
mail (2.6.3)
mime-types (2.6.1)
mini_portile (0.6.2)
minitest (5.7.0, 5.4.3)
mysql2 (0.3.18)
nokogiri (1.6.6.2)
power_assert (0.2.3, 0.2.2)
psych (2.0.13, 2.0.8)
rack (1.6.4)
rack-test (0.6.3)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.6)
rails-html-sanitizer (1.0.2)
rake (10.4.2)
rdoc (4.2.0)
spring (1.3.6)
test-unit (3.1.2, 3.0.8)
thread_safe (0.3.5)
tzinfo (1.2.2) 
harsha@Trebuchet:~/simp_cms$ bundle install
Using rake 10.4.2
/var/lib/gems/1.9.1/gems/bundler-1.10.5/lib/bundler.rb:315: warning: Insecure world writable dir /usr in PATH, mode 040777
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.7.0
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.2
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.6
Using loofah 2.0.2
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.2
Using rack 1.6.4
Using rack-test 0.6.3
Using actionpack 4.2.2
Using globalid 0.3.5
Using activejob 4.2.2
Using mime-types 2.6.1
Using mail 2.6.3
Using actionmailer 4.2.2
Using activemodel 4.2.2
Using arel 6.0.0
Using activerecord 4.2.2
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using columnize 0.9.0
Using debugger-linecache 1.2.0
Using debugger-ruby_core_source 1.3.8
Using debugger 1.6.8
Using mysql2 0.3.18
Using bundler 1.10.5
Using thor 0.19.1
Using railties 4.2.2
Using sprockets 3.2.0
Using sprockets-rails 2.3.2
Using rails 4.2.2
Using rdoc 4.2.0
Using sdoc 0.4.1
Using spring 1.3.6
Using web-console 2.1.3
Bundle complete! 6 Gemfile dependencies, 44 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
harsha@Trebuchet:~/simp_cms$ 

现在当我尝试使用rake命令时,以下错误即将到来

harsha@Trebuchet:~/simp_cms$ bundle exec rake
/var/lib/gems/1.9.1/gems/bundler-1.10.5/lib/bundler/shared_helpers.rb:78: warning: Insecure world writable dir /usr in PATH, mode 040777
Could not find debugger-1.6.8 in any of the sources
Run `bundle install` to install missing gems.
harsha@Trebuchet:~/simp_cms$ gem install debugger -v 1.6.8
Building native extensions.  This could take a while...
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /usr in PATH, mode 040777
ERROR:  Error installing debugger:
    ERROR: Failed to build gem native extension.

    /home/harsha/.rbenv/versions/2.2.2/bin/ruby -r ./siteconf20150628-3517-1lyt1uy.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/harsha/.rbenv/versions/2.2.2/bin/$(RUBY_BASE_NAME)
/home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:1391:in `initialize': No such file or directory @ rb_sysopen - ./222/ruby_debug.h (Errno::ENOENT)
    from /home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:1391:in `open'
    from /home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:1391:in `copy_file'
    from /home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:485:in `copy_file'
    from /home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:402:in `block in cp'
    from /home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:1570:in `block in fu_each_src_dest'
    from /home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:1584:in `fu_each_src_dest0'
    from /home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:1568:in `fu_each_src_dest'
    from /home/harsha/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:401:in `cp'
    from extconf.rb:83:in `block in <main>'
    from extconf.rb:82:in `each'
    from extconf.rb:82:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /home/harsha/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/debugger-1.6.8 for inspection.
Results logged to /home/harsha/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/debugger-1.6.8/gem_make.out
harsha@Trebuchet:~/simp_cms$  

似乎调试器gem有一些问题,但不确定它们是什么

1 个答案:

答案 0 :(得分:3)

发现问题::&#34;调试器&#34; gem与ruby 2.x版本不兼容。

因此在gem文件中注释了调试器并运行&#34; rbenv rehash&#34; &#34;捆绑安装&#34; ......这个问题已经解决了。