捆绑问题

时间:2010-10-18 10:04:12

标签: ruby-on-rails ruby install bundle

我尝试命令bundle install --local 但它显示问题:

-bash: /usr/local/bin/bundle: /usr/local/bin/ruby: bad interpreter: No such file or directory. 

请帮帮我。

5 个答案:

答案 0 :(得分:11)

我认为您需要在.bashrc(linux)中导出ruby和bundle的路径。

打开.bashrc并添加以下行:

export PATH="$PATH:/usr/bin:/usr/local/bin/"

它应该有用。

答案 1 :(得分:4)

在我这边,我正在使用rbenv 当我检查/ usr / local / bin / bundle时,它显示它正在使用较旧的ruby,从而导致问题。

#!/usr/bin/ruby1.9.1

通过将其更改为指向正确的红宝石来解决问题

#!/home/user/.rbenv/shims/ruby

答案 2 :(得分:4)

bundle可执行文件由bundler gem提供。如果您使用rvm,那么在which bundle中看到/usr/local/bin/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/ruby-2.3.4@project/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*

答案 3 :(得分:1)

对于新创建的宝石镶嵌宝石捆绑包对我来说是

在捆绑包安装路径之前,/ usr / local / bin / bundler

安装捆绑包以解决问题。

gem install bundler --no-ri --no-rdoc

Bundler路径更改为/home/root/.rvm/gems/ruby-2.2.1@drag-drop-list/bin/bundler

答案 4 :(得分:-1)

遇到同样的问题, 我在/var/lib/gems/2.3.0/gems/bundler-1.16.1;发现了捆绑器安装 然后我通过创建这样的符号链接来修复错误:

ln -s /var/lib/gems/2.3.0/gems/bundler-1.16.1/ /usr/lib/ruby/gems/2.3.0/gems/bundler-1.16.1

我这样做是因为我需要这个版本的红宝石。