宝石安装捆绑器后,捆绑安装仍然无法正常工作

时间:2016-06-10 04:05:30

标签: ruby-on-rails ruby rubygems

我最初尝试使用捆绑安装但是找不到错误'命令'。 我试过了

gem install bundler

然后尝试了bundle install,但仍然遇到了同样的错误,'bundle:command not found。'

供参考:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.5.1
  - RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-darwin15]
  - INSTALLATION DIRECTORY: /usr/local/opt/gems
  - USER INSTALLATION DIRECTORY: /Users/willashley23/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /usr/local/opt/rbenv/versions/2.3.1/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/opt/gems/bin
  - SPEC CACHE DIRECTORY: /Users/willashley23/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/opt/rbenv/versions/2.3.1/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-15
  - GEM PATHS:
     - /usr/local/opt/gems
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/opt/rbenv/versions/2.3.1/bin
     - /usr/local/Cellar/rbenv/1.0.0/libexec
     - /usr/local/opt/rbenv/shims
     - /Users/willashley23/.rbenv/bin
     - /usr/local/bin
     - /usr/local/sbin
     - ~/bin
     - /Users/willashley23/.rbenv/bin
     - /Users/willashley23/.rbenv/shims
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin 

编辑 ADDED Gemfile:

 source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

1 个答案:

答案 0 :(得分:1)

根据你的尝试,我想出了一些事情。

1.将bundler安装到全局gemset。 rvm gemset use global && gem install bundler

2.如果您安装了Homebrew:尝试brew install ruby

3.如果上述解决方案无法正常工作,那么您可能无法正确获取rvm,因为您不在登录shell中,因此运行

source ~/.rvm/scripts/rvm

然后您可以执行bundle install

4.最后一件事就是你已经在使用rvm了,可能是rvm没有被选为默认值所以运行

rvm use 2.1.1 --default

然后运行bundle install

5.此外,您可以在安装bundler之前尝试rvm get head && rvm reload

如果我遗失了某些内容,请告诉我。