Rails 3 - ошибка прав доступа и странная ошибка TypeError - PullRequest
1 голос
/ 20 января 2012

Попробуйте открыть мою веб-страницу на VDS, а затем получите:

We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.

Итак, вот логи:

Started GET "/" for 176.14.194.67 at 2012-01-20 20:39:10 +0300
  Processing by PagesController#home as HTML
Rendered pages/_unauthorize_home.html.erb (4.0ms)
Rendered pages/home.html.erb within layouts/application (36.0ms)
Compiled blueprint/screen.css  (0ms)  (pid 2376)
Rendered layouts/_stylesheets.html.erb (16.0ms)
Completed 500 Internal Server Error in 108ms

ActionView::Template::Error (Permission denied - /vol/www/apps/ror_tutorial/releases/20120120133926/tmp/cache/assets/D0B):
    1: <!--[if lt IE 9]>
    2: <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    3: <![endif]-->
    4: <%= stylesheet_link_tag 'blueprint/screen', :media => 'screen' %>
    5: <%= stylesheet_link_tag 'blueprint/print',  :media => 'print' %>
    6: <!--[if lt IE 8]><%= stylesheet_link_tag 'blueprint/ie' %><![endif]-->
    7: <%= stylesheet_link_tag 'custom', :media => 'screen' %>
  app/views/layouts/_stylesheets.html.erb:4:in `_app_views_layouts__stylesheets_html_erb___3365052482828129995_20792840'
  app/views/layouts/application.html.erb:8:in `_app_views_layouts_application_html_erb___1751394762871432659_21276200'

Я попробовал следующий

chmod 777 -R /vol/www/apps/ror_tutorial/current/tmp/

Исправлена ​​ошибка с «Отказано в доступе», но это вызвало новую странную ошибку!

Started GET "/" for 176.14.194.67 at 2012-01-20 21:33:37 +0300
  Processing by PagesController#home as HTML
Rendered pages/_unauthorize_home.html.erb (0.0ms)
Rendered pages/home.html.erb within layouts/application (40.0ms)
Rendered layouts/_stylesheets.html.erb (12.0ms)
Compiled application.js  (3ms)  (pid 4546)
Completed 500 Internal Server Error in 292ms

ActionView::Template::Error (TypeError: Cannot call method 'write' of undefined
    at /tmp/execjs20120120-4546-7t6zdm.js:12:20
    at /tmp/execjs20120120-4546-7t6zdm.js:26:16
    at /tmp/execjs20120120-4546-7t6zdm.js:1:92
    at Object.<anonymous> (/tmp/execjs20120120-4546-7t6zdm.js:1:109)
    at Module._loadContent (node.js:667:21)
    at node.js:695:20
    at node.js:304:23
    at node.js:756:9

  (in /vol/www/apps/ror_tutorial/releases/20120120133926/app/assets/javascripts/pages.js.coffee)):
    6:     <%#= auto_discovery_link_tag( :rss, {:controller => "users", :action => "show"} ) %>
    7: 
    8:     <%= render 'layouts/stylesheets' %>
    9:      <%= javascript_include_tag "application" %>                           <%# We are using "application" instead of :defaults because this works.%>
    10:   </head>
    11:   <body>
    12:     <div class="container">
  app/views/layouts/application.html.erb:9:in `_app_views_layouts_application_html_erb___4331846574104382680_15766720'

Полагаю, это происходит из-за nodejs, который я установил, но я не уверен.

Вот права на tmp /

$ ls -alh /vol/www/apps/ror_tutorial/current/tmp/

drwxrwxrwx  3 root root 4.0K 2012-01-20 19:14 .
drwxrwxr-x 17 root root 4.0K 2012-01-20 18:57 ..
drwxrwxrwx  3 root root 4.0K 2012-01-20 19:14 cache
lrwxrwxrwx  1 root root   38 2012-01-20 16:41 pids -> /vol/www/apps/ror_tutorial/shared/pids
-rwxrwxrwx  1 root root    0 2012-01-20 16:41 restart.txt

$ ls -alh /vol/www/apps/ror_tutorial/current/tmp/cache/assets

 total 56K
drwxrwxrwx 14 root root 4.0K 2012-01-20 20:40 .
drwxrwxrwx  3 root root 4.0K 2012-01-20 19:14 ..
drwxrwxrwx  3 root root 4.0K 2012-01-20 19:14 CDB
drwxrwxrwx  3 root root 4.0K 2012-01-20 19:14 CF0
drwxrwxrwx  3 root root 4.0K 2012-01-20 20:40 CF9
drwxrwxrwx  3 root root 4.0K 2012-01-20 20:40 D0B
drwxrwxrwx  3 root root 4.0K 2012-01-20 20:40 D15
drwxrwxrwx  3 root root 4.0K 2012-01-20 20:40 D1D
drwxrwxrwx  3 root root 4.0K 2012-01-20 20:40 D2F
drwxrwxrwx  3 root root 4.0K 2012-01-20 20:40 D3B
drwxrwxrwx  3 root root 4.0K 2012-01-20 20:40 D40
drwxrwxrwx  3 root root 4.0K 2012-01-20 20:40 D62
drwxrwxrwx  3 root root 4.0K 2012-01-20 19:14 DA9
drwxrwxrwx  3 root root 4.0K 2012-01-20 19:14 E04

Моя система:

Ubuntu 10.04
PostgreSQL 9.1
Rails 3.1.3
Ruby 1.9.3p27
Nginx 1.0.11 (installed/compiled by passenger)
Phusion passenger 3.0.11
Capistrano

production.rb

SampleApp::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb

  # Code is not reloaded between requests
  config.cache_classes = true

  # Full error reports are disabled and caching is turned on
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  # Disable Rails's static asset server (Apache or nginx will already do this)
  config.serve_static_assets = true

  # Compress JavaScripts and CSS
  config.assets.compress = true

  # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = true

  # Generate digests for assets URLs
  config.assets.digest = true

  # Defaults to Rails.root.join("public/assets")
  # config.assets.manifest = YOUR_PATH

  # Specifies the header that your server uses for sending files
  # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx

  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
  # config.force_ssl = true

  # See everything in the log (default is :info)
  # config.log_level = :debug

  # Use a different logger for distributed setups
  # config.logger = SyslogLogger.new

  # Use a different cache store in production
  # config.cache_store = :mem_cache_store

  # Enable serving of images, stylesheets, and JavaScripts from an asset server
  # config.action_controller.asset_host = "http://assets.example.com"

  # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
  # config.assets.precompile += %w( search.js )

  # Disable delivery errors, bad email addresses will be ignored
  # config.action_mailer.raise_delivery_errors = false

  # Enable threaded mode
  # config.threadsafe!

  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
  # the I18n.default_locale when a translation can not be found)
  config.i18n.fallbacks = true

  # Send deprecation notices to registered listeners
  config.active_support.deprecation = :notify
end

Кроме того, я захожу в свою ОС как пользователь root.

Как я могу это исправить?

1 Ответ

2 голосов
/ 21 января 2012

Я решил это! Проблема была в node-v0.1.31. Я удалил старую версию, а затем установил новую:

git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install

Теперь все хорошо!

...