私は「キャップ生産デプロイ」Ruby on Railsプロジェクトは、 - >「キャップ生産デプロイ」によってエラー - >エラーrbenv:2.2.2がインストールされていないか、見つからない
ERROR rbenv: 2.2.2 is not installed or not found in /usr/local/rbenv/versions/2.2.2
を実行しようとすることで、エラーを経験しています
これは私のGemfileです:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.2'
# 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'
gem 'turbolinks'
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
gem 'byebug'
# 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
group :development do
gem 'capistrano', '~> 3.4.0'
gem 'capistrano-rails', '~> 1.1.3'
gem 'capistrano-rbenv' #'~> 2.2.0'
gem 'capistrano-passenger'
end
これは私のCapfileです:
# Load DSL and set up stages
require 'capistrano/setup'
# Include default deployment tasks
require 'capistrano/deploy'
require 'capistrano/rbenv'
set :rbenv_type, :user # or :system, depends on your rbenv setup
set :rbenv_ruby, '2.2.0'
require 'capistrano/bundler'
require 'capistrano/rails'
require 'capistrano/passenger'
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
これは私のdeploy.rbファイルです:
コマンドで# config valid only for current version of Capistrano
lock '3.4.0'
set :application, 'blank1'
set :repo_url, '[email protected]:r2artene/blank1.git'
# setup rvm.
set :rbenv_type, :system
set :rbenv_ruby, '2.2.0'
# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
# Default deploy_to directory is /var/www/my_app_name
set :deploy_to, '/home/deploy/blank1'
# Default value for :scm is :git
# set :scm, :git
# Default value for :format is :pretty
# set :format, :pretty
# Default value for :log_level is :debug
# set :log_level, :debug
# Default value for :pty is false
# set :pty, true
# Default value for :linked_files is []
# set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')
# Default value for linked_dirs is []
# set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')
set :linked_files, %w{config/database.yml config/secrets.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
# Default value for keep_releases is 5
# set :keep_releases, 5
namespace :deploy do
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
end
「ルビー-v」ローカルマシン上で私が得る結果は次のとおりです。コマンドで
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
「ルビー-v」deplomentサーバー上の私が得る結果は次のとおりです。
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
Rbenvに加えてRVMを使用していますか? 'rvm notes'を実行し、出力が得られるかどうかを確認してください。 – MarsAtomic
これが結果です:あなたがしたい場合は *:http://rvm.io/helpとhttps://twitter.com/rvm_io インストールノート:/ルビー/ blank1 $ RVMは、問題が発生した場合には ノートプロジェクトの.rvmrcファイル機能を無効にするには、/ etc/rvmrcまたは〜/ .rvmrcに rvm_project_rvmrc = 0を設定します。 その後ログアウトしてからログインしてください。 –