簡體   English   中英

gem install bundler之后,捆綁安裝仍然無法正常工作

[英]Bundle install still not working after gem install bundler

我最初嘗試使用捆綁安裝,但收到錯誤“找不到命令”。 我試過了

gem install bundler

然后嘗試安裝捆綁軟件,但仍然遇到相同的錯誤,“未找到捆綁軟件:命令”。

以供參考:

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 

編輯添加的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.將bundler安裝到全局gemset。 rvm gemset use global && gem install bundler

2.如果您安裝了Homebrew:請嘗試brew install ruby

3.如果上述解決方案不起作用,則可能是由於您不在登錄shell中,因此您沒有正確采購rvm,因此請運行

source ~/.rvm/scripts/rvm

然后您可以執行bundle install

4.最后是因為您已經在使用rvm,可能是沒有選擇rvm作為默認情況,所以運行

rvm use 2.1.1 --default

然后運行bundle install

5.另外,您可以在安裝捆綁器之前嘗試rvm get head && rvm reload

讓我知道我是否想念一些東西。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM