title: Rails 3 - Permissions error and strange TypeError
body: <p>Try to open my web-page on vds and then get:</p>
  
  <pre><code>We're sorry, but something went wrong.
  We've been notified about this issue and we'll take a look at it shortly.
  </code></pre>
  
  <p>So, here are logs:</p>
  
  <pre><code>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: &lt;!--[if lt IE 9]&gt;
      2: &lt;script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"&gt;&lt;/script&gt;
      3: &lt;![endif]--&gt;
      4: &lt;%= stylesheet_link_tag 'blueprint/screen', :media =&gt; 'screen' %&gt;
      5: &lt;%= stylesheet_link_tag 'blueprint/print',  :media =&gt; 'print' %&gt;
      6: &lt;!--[if lt IE 8]&gt;&lt;%= stylesheet_link_tag 'blueprint/ie' %&gt;&lt;![endif]--&gt;
      7: &lt;%= stylesheet_link_tag 'custom', :media =&gt; 'screen' %&gt;
    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'
  </code></pre>
  
  <p>I tried next</p>
  
  <pre><code>chmod 777 -R /vol/www/apps/ror_tutorial/current/tmp/
  </code></pre>
  
  <p>It solved error with 'Permission denied' but this caused new strange error!</p>
  
  <pre><code>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.&lt;anonymous&gt; (/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:     &lt;%#= auto_discovery_link_tag( :rss, {:controller =&gt; "users", :action =&gt; "show"} ) %&gt;
      7: 
      8:     &lt;%= render 'layouts/stylesheets' %&gt;
      9:      &lt;%= javascript_include_tag "application" %&gt;                           &lt;%# We are using "application" instead of :defaults because this works.%&gt;
      10:   &lt;/head&gt;
      11:   &lt;body&gt;
      12:     &lt;div class="container"&gt;
    app/views/layouts/application.html.erb:9:in `_app_views_layouts_application_html_erb___4331846574104382680_15766720'
  </code></pre>
  
  <p>I suppose that is happens because of <code>nodejs</code> which i have installed but i am not sure.</p>
  
  <p>Here are rights for tmp/</p>
  
  <pre><code>$ 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 -&gt; /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
  </code></pre>
  
  <p>My system:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>production.rb</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Also, i log into my OS as root user.</p>
  
  <p>How can i fix that?</p>