Rails 3 - 权限错误和奇怪的 TypeError
尝试在 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 用户身份登录我的操作系统。
我该如何解决这个问题?
Try to open my web-page on vds and then get:
We're sorry, but something went wrong.
We've been notified about this issue and we'll take a look at it shortly.
So, here are logs:
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'
I tried next
chmod 777 -R /vol/www/apps/ror_tutorial/current/tmp/
It solved error with 'Permission denied' but this caused new strange error!
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'
I suppose that is happens because of nodejs
which i have installed but i am not sure.
Here are rights for 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
My system:
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
Also, i log into my OS as root user.
How can i fix that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我解决了!问题出在node-v0.1.31 中。我删除了旧版本,然后安装了新版本:
现在一切都很好!
I solved it! Problem was in node-v0.1.31. I removed old version and then installed new one:
Now everything is fine!