Bundle exec无法加载这样的文件 - / var / www / backoffice / config / application

时间:2017-01-30 17:12:09

标签: ruby-on-rails ruby nginx

我试图在CentOS 7服务器中执行命令bundle exec rake assets:precompile db:migrate RAILS_ENV=production,作为名为" backoffice"的用户。使用sudo权限(本教程中的步骤2.4 https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/el7/deploy_app.html),但它一直给出此错误:

rake aborted!
LoadError: cannot load such file -- /var/www/backoffice/config/application
/var/www/backoffice/Rakefile:4:in `require_relative'
/var/www/backoffice/Rakefile:4:in `<top (required)>'
/var/www/backoffice/vendor/bundle/ruby/2.3.0/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.3/gems/bundler-1.14.3/lib/bundler/cli/exec.rb:74:in `load'
/usr/local/rvm/gems/ruby-2.3.3/gems/bundler-1.14.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
/usr/local/rvm/gems/ruby-2.3.3/gems/bundler-1.14.3/lib/bundler/cli/exec.rb:27:in `run'
/usr/local/rvm/gems/ruby-2.3.3/gems/bundler-1.14.3/lib/bundler/cli.rb:335:in `exec'
/usr/local/rvm/gems/ruby-2.3.3/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/rvm/gems/ruby-2.3.3/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/usr/local/rvm/gems/ruby-2.3.3/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/usr/local/rvm/gems/ruby-2.3.3/gems/bundler-1.14.3/lib/bundler/cli.rb:20:in `dispatch'
/usr/local/rvm/gems/ruby-2.3.3/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/usr/local/rvm/gems/ruby-2.3.3/gems/bundler-1.14.3/lib/bundler/cli.rb:11:in `start'
/usr/local/rvm/gems/ruby-2.3.3/gems/bundler-1.14.3/exe/bundle:32:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-2.3.3/gems/bundler-1.14.3/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
/usr/local/rvm/gems/ruby-2.3.3/gems/bundler-1.14.3/exe/bundle:24:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.3/bin/bundle:22:in `load'
/usr/local/rvm/gems/ruby-2.3.3/bin/bundle:22:in `<main>'
/usr/local/rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in `<main>'

这是我第一次生产部署rails应用程序,我不知道可能是什么问题。有人可以帮忙吗?如果您需要额外的信息,请说。

我的Gemfile是:

source 'http://rubygems.org' #'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# 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.2'
# 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 navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# 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', platform: :mri
  gem 'awesome_print'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'devise'

gem 'bootstrap-sass', '~> 3.3.6'

#To generate files for an improved application layout
group :development do
  gem 'rails_layout'
 # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console'
end

gem 'font-awesome-sass'

# Para criar paginacao
gem 'kaminari'

gem 'httparty'

# Para permitir usar o datepicker do bootstrap
gem 'bootstrap-datepicker-rails'

# Para permitir usar o datetimepicker do bootstrap
gem 'momentjs-rails', '>= 2.9.0'
gem 'bootstrap3-datetimepicker-rails', '~> 4.17.42'

# Para configuracoes locais relacionados com a lingua de um pais
gem 'rails-i18n'

# Para o application.js nao carregar apenas quando se faz reload (F5)
gem 'jquery-turbolinks'

gem 'rest-client'

# Para fazer versionamento de modelos
gem 'paper_trail'

# Diff::LCS computes the difference between two Enumerable sequences using the McIlroy-Hunt longest common
# subsequence (LCS) algorithm. It includes utilities to create a simple HTML diff output format and a
# standard diff-like tool. https://github.com/halostatue/diff-lcs
gem 'diff-lcs'

# Generates a diff from two strings or files. https://github.com/samg/diffy
gem 'diffy'

gem 'nokogiri'
gem 'bcrypt'

我的Gemfile.lock是:

GEM
  remote: http://rubygems.org/
  specs:
    actioncable (5.0.0.1)
      actionpack (= 5.0.0.1)
      nio4r (~> 1.2)
      websocket-driver (~> 0.6.1)
    actionmailer (5.0.0.1)
      actionpack (= 5.0.0.1)
      actionview (= 5.0.0.1)
      activejob (= 5.0.0.1)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.0.0.1)
      actionview (= 5.0.0.1)
      activesupport (= 5.0.0.1)
      rack (~> 2.0)
      rack-test (~> 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (5.0.0.1)
      activesupport (= 5.0.0.1)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activejob (5.0.0.1)
      activesupport (= 5.0.0.1)
      globalid (>= 0.3.6)
    activemodel (5.0.0.1)
      activesupport (= 5.0.0.1)
    activerecord (5.0.0.1)
      activemodel (= 5.0.0.1)
      activesupport (= 5.0.0.1)
      arel (~> 7.0)
    activesupport (5.0.0.1)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (~> 0.7)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    arel (7.1.4)
    autoprefixer-rails (6.5.3)
      execjs
    awesome_print (1.7.0)
    bcrypt (3.1.11)
    bcrypt (3.1.11-x86-mingw32)
    bootstrap-datepicker-rails (1.6.4.1)
      railties (>= 3.0)
    bootstrap-sass (3.3.7)
      autoprefixer-rails (>= 5.2.1)
      sass (>= 3.3.4)
    bootstrap3-datetimepicker-rails (4.17.42)
      momentjs-rails (>= 2.8.1)
    builder (3.2.2)
    byebug (9.0.6)
    coffee-rails (4.2.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.2.x)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.10.0)
    concurrent-ruby (1.0.2)
    debug_inspector (0.0.2)
    devise (4.2.0)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 4.1.0, < 5.1)
      responders
      warden (~> 1.2.3)
    diff-lcs (1.2.5)
    diffy (3.1.0)
    domain_name (0.5.20161021)
      unf (>= 0.0.5, < 1.0.0)
    erubis (2.7.0)
    execjs (2.7.0)
    ffi (1.9.14-x86-mingw32)
    font-awesome-sass (4.7.0)
      sass (>= 3.2)
    globalid (0.3.7)
      activesupport (>= 4.1.0)
    http-cookie (1.0.3)
      domain_name (~> 0.5)
    httparty (0.14.0)
      multi_xml (>= 0.5.2)
    i18n (0.7.0)
    jbuilder (2.6.0)
      activesupport (>= 3.0.0, < 5.1)
      multi_json (~> 1.2)
    jquery-rails (4.2.1)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    jquery-turbolinks (2.1.0)
      railties (>= 3.1.0)
      turbolinks
    kaminari (0.17.0)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.4)
      mime-types (>= 1.16, < 4)
    method_source (0.8.2)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mini_portile2 (2.1.0)
    minitest (5.9.1)
    momentjs-rails (2.15.1)
      railties (>= 3.1)
    multi_json (1.12.1)
    multi_xml (0.5.5)
    netrc (0.11.0)
    nio4r (1.2.1)
    nokogiri (1.6.8.1)
      mini_portile2 (~> 2.1.0)
    nokogiri (1.6.8.1-x86-mingw32)
      mini_portile2 (~> 2.1.0)
    orm_adapter (0.5.0)
    paper_trail (6.0.1)
      activerecord (>= 4.0, < 5.2)
      request_store (~> 1.1)
    puma (3.6.0)
    rack (2.0.1)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (5.0.0.1)
      actioncable (= 5.0.0.1)
      actionmailer (= 5.0.0.1)
      actionpack (= 5.0.0.1)
      actionview (= 5.0.0.1)
      activejob (= 5.0.0.1)
      activemodel (= 5.0.0.1)
      activerecord (= 5.0.0.1)
      activesupport (= 5.0.0.1)
      bundler (>= 1.3.0, < 2.0)
      railties (= 5.0.0.1)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.1)
      activesupport (>= 4.2.0, < 6.0)
      nokogiri (~> 1.6.0)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    rails-i18n (5.0.1)
      i18n (~> 0.7)
      railties (~> 5.0)
    rails_layout (1.0.34)
    railties (5.0.0.1)
      actionpack (= 5.0.0.1)
      activesupport (= 5.0.0.1)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (11.3.0)
    request_store (1.3.1)
    responders (2.3.0)
      railties (>= 4.2.0, < 5.1)
    rest-client (2.0.0)
      http-cookie (>= 1.0.2, < 2.0)
      mime-types (>= 1.16, < 4.0)
      netrc (~> 0.8)
    rest-client (2.0.0-x86-mingw32)
      ffi (~> 1.9)
      http-cookie (>= 1.0.2, < 2.0)
      mime-types (>= 1.16, < 4.0)
      netrc (~> 0.8)
    sass (3.4.22)
    sass-rails (5.0.6)
      railties (>= 4.0.0, < 6)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    sprockets (3.7.0)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    sqlite3 (1.3.12)
    sqlite3 (1.3.12-x86-mingw32)
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (2.0.5)
    turbolinks (5.0.1)
      turbolinks-source (~> 5)
    turbolinks-source (5.0.0)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    tzinfo-data (1.2016.9)
      tzinfo (>= 1.0.0)
    uglifier (3.0.3)
      execjs (>= 0.3.0, < 3)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.7.2)
    unf_ext (0.0.7.2-x86-mingw32)
    warden (1.2.6)
      rack (>= 1.0)
    web-console (3.4.0)
      actionview (>= 5.0)
      activemodel (>= 5.0)
      debug_inspector
      railties (>= 5.0)
    websocket-driver (0.6.4)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.2)

PLATFORMS
  ruby
  x86-mingw32
  x86_64-linux

DEPENDENCIES
  awesome_print
  bcrypt
  bootstrap-datepicker-rails
  bootstrap-sass (~> 3.3.6)
  bootstrap3-datetimepicker-rails (~> 4.17.42)
  byebug
  coffee-rails (~> 4.2)
  devise
  diff-lcs
  diffy
  font-awesome-sass
  httparty
  jbuilder (~> 2.5)
  jquery-rails
  jquery-turbolinks
  kaminari
  momentjs-rails (>= 2.9.0)
  nokogiri
  paper_trail
  puma (~> 3.0)
  rails (~> 5.0.0, >= 5.0.0.1)
  rails-i18n
  rails_layout
  rest-client
  sass-rails (~> 5.0)
  sqlite3
  turbolinks (~> 5)
  tzinfo-data
  uglifier (>= 1.3.0)
  web-console

BUNDLED WITH
   1.14.3

这是我的目录结构和权限:

drwxrwxrwx. 15 root       root       4096 Jan 30 16:24 .
drwxr-xr-x.  3 root       root         23 Jan 30 12:54 ..
drwxrwxrwx. 10 root       root       4096 Jan 30 12:54 app
drwxrwxrwx.  2 root       root         67 Jan 30 12:54 bin
drwxrwxr-x.  2 backoffice backoffice   19 Jan 30 16:24 .bundle
drwx------.  5 root       root       4096 Jan 30 12:54 config
-rwxrwxrwx.  1 root       root        130 Jan 30 12:54 config.ru
drwx------.  3 root       root         77 Jan 30 12:54 db
-rw-rw-rw-.  1 backoffice backoffice 2642 Jan 30 15:11 Gemfile
-rw-rw-rw-.  1 backoffice backoffice 6134 Jan 30 15:11 Gemfile.lock
-rwxrwxrwx.  1 root       root        566 Jan 30 12:54 .gitignore
drwxrwxrwx.  3 root       root         42 Jan 30 12:54 .idea
drwxrwxrwx.  4 root       root         31 Jan 30 12:54 lib
drwxrwxrwx.  2 root       root         40 Jan 30 12:54 log
-rwxrwxrwx.  1 root       root        441 Jan 30 12:54 .project
drwxrwxrwx.  2 root       root       4096 Jan 30 12:54 public
-rwxrwxrwx.  1 root       root        227 Jan 30 12:54 Rakefile
-rwxrwxrwx.  1 root       root        374 Jan 30 12:54 README.md
drwxrwxrwx.  4 root       root         70 Jan 30 15:11 .svn
drwxrwxrwx.  8 root       root       4096 Jan 30 12:54 test
drwxrwxrwx.  5 root       root         73 Jan 30 12:54 tmp
drwxrwxrwx.  4 root       root         32 Jan 30 13:02 vendor

提前致谢!

1 个答案:

答案 0 :(得分:0)

我发现问题与文件夹权限有关。我赋予文件夹rwx权限,命令运行成功。 不管怎样,谢谢!