ruby - 無法載入此類檔案-bundle/bundler/setup (LoadError)
大家讲道理
大家讲道理 2017-04-24 09:09:44
0
1
1002

初學 ruby​​,嘗試使用 zhaocai/alfred2-ruby-template 寫 Alfred Workflow 時遇到以下錯誤:

bash$ ruby​​ main.rb
/Users/tranch/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundle/bundler /setup (LoadError)
    from /Users/tranch/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from main.rb:5:in `<main>'

Google 了下相關關鍵字,都說因為沒裝 bundler,但是反覆驗證了一番,證明確實是都安裝了:

bash$ which gem
/Users/tranch/.rvm/rubies/ruby-2.2.0/bin/gemmaster*

$ gem list -d bundler

*** LOCAL GEMS ***

bundler (1.10.3)
    Authors: André Arko, Terence Lee, Carl Lerche, Yehuda Katz
    Homepage: http://bundler.io
    License: MIT
    Installed at: /Users/tranch/.rvm/gems/ruby-2.2.0

    The best way to manage your application’s dependencies

bundler-unload (1.0.2)
    Author: Michal Papis
    Homepage: https://github.com/mpapis/bundler-unload
    License: Apache 2.0
    Installed at: /Users/tranch/.rvm/gems/ruby-2.2.0@global

    Allow unloading bundler after Bundler.load

rubygems-bundler (1.4.4)
    Authors: Josh Hull, Michal Papis
    Homepage: http://mpapis.github.com/rubygems-bundler
    License: Apache-2.0
    Installed at: /Users/tranch/.rvm/gems/ruby-2.2.0@global

    Stop using bundle exec

$ which bundle
/Users/tranch/.rvm/gems/ruby-2.2.0/bin/bundle

$ bundle
Using fuzzy_match 2.1.0
Using builder 3.2.2
Using gyoku 1.3.1
Using moneta 0.8.0
Using nori 2.6.0
Using plist 3.1.0
Using terminal-notifier 1.6.3
Using alfred-workflow 2.0.5
Using bundler 1.10.3
Bundle complete! 2 Gemfile dependencies, 9 gems now installed.
Bundled gems are installed into ./bundle.

求解。

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

全部回覆(1)
伊谢尔伦

應該是引用 require 'bundler/setup' 試試看, 參考 http://bundler.io/bundler_setup.html

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板