gpt4 book ai didi

ruby-on-rails - 加载错误 : cannot load such file -- active_support

转载 作者:数据小太阳 更新时间:2023-10-29 07:17:34 53 4
gpt4 key购买 nike

我使用 Capistrano 来部署我的应用程序。 Ruby 由 RVM 安装在我的 Mac 上,服务器上的 Ruby 版本 (2.2.5) 由 rbenv 安装。

我想cap production deploy后出现如下错误:

SSHKit::Command::Failed: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
LoadError: cannot load such file -- active_support
/home/user/app/shared/bundle/ruby/2.2.0/gems/railties-4.1.14/lib/rails.rb:5:in `require'
/home/user/app/shared/bundle/ruby/2.2.0/gems/railties-4.1.14/lib/rails.rb:5:in `<top (required)>'
/home/user/app/shared/bundle/ruby/2.2.0/gems/railties-4.1.14/lib/rails/all.rb:1:in `require'
/home/user/app/shared/bundle/ruby/2.2.0/gems/railties-4.1.14/lib/rails/all.rb:1:in `<top (required)>'
/home/user/app/releases/20160606092956/config/application.rb:3:in `require'
/home/user/app/releases/20160606092956/config/application.rb:3:in `<top (required)>'
/home/user/app/releases/20160606092956/Rakefile:4:in `require'
/home/user/app/releases/20160606092956/Rakefile:4:in `<top (required)>'
/home/user/.rbenv/versions/2.2.5/bin/bundle:23:in `load'
/home/user/.rbenv/versions/2.2.5/bin/bundle:23:in `<main>'
(See full trace by running task with --trace)

DEBUG [0ac2a446] Bundled gems are installed into /home/user/app/shared/bundle.
INFO [0ac2a446] Finished in 0.509 seconds with exit status 0 (successful).
DEBUG [d7061392] Running if test ! -d /home/user/app/releases/20160606043027; then echo "Directory does not exist '/home/user/app/releases/2016060604…
DEBUG [d7061392] Command: if test ! -d /home/user/app/releases/20160606043027; then echo "Directory does not exist '/home/user/app/releases/201606060…
DEBUG [d7061392] Finished in 0.036 seconds with exit status 0 (successful).
INFO [b8dc48fb] Running bundle exec rake assets:precompile as user@52.28.250.42
DEBUG [b8dc48fb] Command: cd /home/user/app/releases/20160606043027 && ( export RAILS_ENV="production" ; bundle exec rake assets:precompile )
DEBUG [b8dc48fb] rake aborted!
DEBUG [b8dc48fb] LoadError: cannot load such file -- active_support
DEBUG [b8dc48fb] /home/user/app/shared/bundle/ruby/2.2.0/gems/railties-4.1.14/lib/rails.rb:5:in `require'
/home/user/app/shared/bundle/ruby/2.2.0/gems/railties-4.1.14/lib/rails.rb:5:in `<top (required)>'
/home/user/app/shared/bundle/ruby/2.2.0/gems/railties-4.1.14/lib/rails/all.rb:1:in `require'
/home/user/app/shared/bundle/ruby/2.2.0/gems/railties-4.1.14/lib/rails/all.rb:1:in `<top (required)>'
/home/user/app/releases/20160606043027/config/application.rb:3:in `require'
/home/user/app/releases/20160606043027/config/application.rb:3:in `<top (required)>'
/home/user/app/releases/20160606043027/Rakefile:4:in `require'
/home/user/app/releases/20160606043027/Rakefile:4:in `<top (required)>'
/home/user/.rbenv/versions/2.2.5/bin/bundle:23:in `load'
/home/user/.rbenv/versions/2.2.5/bin/bundle:23:in `<main>'
DEBUG [b8dc48fb] (See full trace by running task with --trace)

这是 deploy.rb:

lock '3.5.0'

set :application, "app_#{fetch(:stage)}"

set :repo_url, 'git@bitbucket.org:...'

set :user, 'user'

server "ip_adress", user: fetch(:user), roles: %w(app db web)

set :deploy_to, "/home/#{fetch(:user)}/#{fetch(:application)}"

# Default value for :pty is false
# set :pty, true

set :linked_files, fetch(:linked_files, []).push("config/database.yml")
set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')

set :bundle_flags, '--deployment'
set :bundle_jobs, 4

set :keep_assets, 2

set :use_sudo, true

set :rbenv_type, :user
set :rbenv_ruby, "2.2.5"

set :rails_env, fetch(:stage)

set :passenger_restart_with_touch, true

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

我的 gem 文件:

source 'https://rubygems.org'


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

gem 'jquery-rails'

gem 'turbolinks'
gem "therubyracer"
gem "less-rails"

# UI
gem 'nprogress-rails'
gem "twitter-bootstrap-rails"
gem "simple-navigation"
gem 'autosize-rails'
gem "emoticons_helper"

### Autentication
gem "devise"
gem 'cancancan', '~> 1.10'

gem 'omniauth'
gem 'omniauth-twitter'
gem 'omniauth-facebook'
gem "omniauth-linkedin"

# utils
gem "quiet_assets"
gem 'social-share-button'

gem 'dragonfly', '~> 1.0.12'

gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

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

# gem "thin"

gem 'jquery-ui-rails'
gem 'jquery-modal-rails'

gem "capistrano", "~> 3.5.0"

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'capistrano-rbenv', require: false
gem 'capistrano-bundler', require: false
gem 'capistrano-rails', require: false
gem 'capistrano-passenger', require: false
gem 'byebug'
end

gem "activesupport", "~> 4.1.14"


# 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

# Use debugger
# gem 'debugger', group: [:development, :test]

服务器是带有 Ubuntu、Ruby 2.2.5(由 rbenv 安装)的 Amazon EC2。

这是 gem active_support 的错误,还是我做错了什么?

最佳答案

我不认为你做错了什么。我的猜测是您遇到了 Bundler 中的错误,或者存在阻止加载 ActiveSupport gem 的文件权限问题。

检查这些东西:

  1. 验证 ActiveSupport 确实安装在 /home/ubuntu/jozu_production/shared/bundle/ruby/2.2.0/gems 中。您应该会看到一个名为 activesupport-4.1.14 的目录,该目录归您的 ubuntu 用户所有。确保该目录及其内容都属于 ubuntu 并且是可读的。

  2. 确保您在 rbenv 管理的 Ruby 2.2.5 环境中安装了最新版本的 Bundler。在撰写本文时,即 Bundler 1.12.5。 (运行 gem install bundler。)

  3. 尝试在服务器上手动运行预编译命令以查看行为是否有任何差异。将 --trace 添加到命令以获取其他故障排除数据。

    cd /home/ubuntu/jozu_production/releases/20160606043027 && ( export RAILS_ENV="production" ; bundle exec rake assets:precompile --trace )

关于ruby-on-rails - 加载错误 : cannot load such file -- active_support,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37653118/

53 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com