我試着命令bundle install --local
但它顯示的問題:問題捆
-bash: /usr/local/bin/bundle: /usr/local/bin/ruby: bad interpreter: No such file or directory.
請幫助我。
我試着命令bundle install --local
但它顯示的問題:問題捆
-bash: /usr/local/bin/bundle: /usr/local/bin/ruby: bad interpreter: No such file or directory.
請幫助我。
在我身邊,我使用rbenv。
當我檢查/ usr/local/bin/bundle時,它顯示它使用的是較舊的ruby,因此導致該問題。
#!/usr/bin/ruby1.9.1
通過改變它指向正確的紅寶石解決問題
#!/home/user/.rbenv/shims/ruby
這工作對我來說是完全不同的,也許是因爲我一直在使用約RVM或不相矛盾的解決方案。
我使用'哪個捆綁器'來找出捆綁器的啓動位置,它來自/ usr/bin/bundler。注意到,在/ usr/bin中/捆紮機開始位置和紅寶石的版本,沒有我的系統上是否存在任何更多的,我做了
gem uninstall bundler
gem install bundler
檢查「這打捆」再次證實,現在捆綁了內安裝。 rvm環境而不是/ usr/bin/bundler,現在引用了正確的ruby版本;所以捆綁安裝現在適用於我的rails項目。
對於新創建的珠寶鑲嵌寶石捆綁缺少對我來說,
捆綁之前爲其安裝路徑是/ usr/local/bin目錄/捆紮機
安裝捆綁來解決問題。
gem install bundler --no-ri --no-rdoc
捆紮機路徑改變爲,/home/root/.rvm/gems/[email protected]/bin/bundler
的bundle
可執行由bundler
寶石提供。如果您使用的是rvm
,則在/usr/local/bin/bundle
中看到which bundle
表示存在問題,因爲使用rvm
意味着像bundler
這樣的寶石安裝在您的主目錄下,通常位於~/.rvm/gems/...
。
# Symptoms of a broken bundler installation:-
# Cannot start Rails...
$ bin/rails s
/Users/rogermarlow/project/config/boot.rb:9:in 'rescue in <top (required)>': uninitialized constant Bundler (NameError)
# bundle not working...
$ bundle install
zsh: /usr/local/bin/bundle: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin: no such file or directory
# ^----- that path does not look right, rvm does not put gems there
$ which bundle
/usr/local/bin/bundle
# ^--- I want bundle from something under ~/.rvm/gems
# First check rvm is in effect:
$ rvm reload
RVM reloaded!
$ which ruby
/Users/rogermarlow/.rvm/rubies/ruby-2.3.4/bin/ruby
# ^--looks good, it is an rvm path, not /usr/local/bin/...
# Now fix bundler
$ gem uninstall bundler # just in case
$ gem install bundler
Fetching: bundler-1.16.1.gem (100%)
Successfully installed bundler-1.16.1
1 gem installed
$ which bundle
/Users/rogermarlow/.rvm/gems/[email protected]/bin/bundle
$ ^--- that is better, bundle is on a path controlled by rvm
# bundle now working
$ bundle install
Fetching gem metadata from http://rubygems.org/..........
*snip*
# rails now working
$ bin/rails s
=> Booting Thin
=> Rails 4.2.7.1 application starting in development on http://localhost:3000
*snip*
謝謝羅傑。按照你的步驟爲我解決了類似的問題 – 2018-01-30 13:35:38
請嘗試:'哪個ruby'和'哪個bundle'共享輸出 – zengr 2010-10-18 10:06:53
其中ruby:/ usr/bin/ruby。哪個包:/ usr/local/bin/bundle – khanh 2010-10-18 10:08:07
你在/ usr/local/bin/ruby上有紅寶石?你使用rvm? – shingara 2010-10-18 10:11:29