Rails 5.1.6 issues with assets - ruby-on-rails

I recently installed rails 5.1.6 but when I go to any one of the views in an application, it throws the following error.
Errno::ENOENT in Test#index
No such file or directory # unlink_internal - C:/Users/Bastian/AppData/Local/Temp/execjs20180513-17244-1f5fvjjson
Started GET "/test/index" for 127.0.0.1 at 2018-05-13 20:22:07 -0400
Processing by TestController#index as HTML
Rendering test/index.html.erb within layouts/application
Rendered test/index.html.erb within layouts/application (1.0ms)
Access Denied.
Completed 500 Internal Server Error in 427ms
ActionView::Template::Error (No such file or directory # unlink_internal - C:/Users/Bastian/AppData/Local/Temp/execjs20180513-17244-1f5fvjjson):
4: <title>Testr</title>
5: <%= csrf_meta_tags %>
6:
7: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8: <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
9: </head>
10:
app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__530887143_69788540'
I've been looking everywhere but haven't found a solution.
I hope somebody can help me.

Well, finally I figured out how to get rid of the error thanks to this answer in https://stackoverflow.com/a/17748774/8048737
In resume I deleted these two lines from application.js:
//= require turbolinks
//= require_tree .

Related

Rails error after creates new page ActionView::Template::Error (The asset "application.css" is not present in the asset pipeline

I want to create a maintanance_mode page in my rails app. So I've created StaticPagesController with maintanance_mode method (it's empty) and views views/static_page/maintanance_mode.html.erb with routes below:
Rails.application.routes.draw do
root to: 'react#index',
get: '/maintanance_mode', to: 'static_pages#maintanance_mode'
scope 'api' do
use_doorkeeper do
skip_controllers :applications, :authorized_applications, :authorizations
end
end
I was trying to get into this page (simple Hello) but I've got an error
ActionView::Template::Error (The asset "application.css" is not present in the asset pipeline.):
8: <%= csrf_meta_tags %>
9: <%= csp_meta_tag %>
10:
11: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
12: <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
13: </head>
14:
The solution was quite simple, I have to add application.css with below code
application.css
/* ...
*= require_self
*= require_tree .
*/

Ruby on Rails v5.1.1 Home Page

I'm starting to develop in RoR and I have found the following problem:
Message
The command prompt:
Started GET "/pages/inicio" for 127.0.0.1 at 2017-06-22 22:43:24 -0300
Processing by PagesController#inicio as HTML
Rendering pages/inicio.html.erb within layouts/application
Rendered pages/inicio.html.erb within layouts/application (0.5ms)
Completed 500 Internal Server Error in 844ms
ActionView::Template::Error ():
4: <title>Pmo</title>
5: <%= csrf_meta_tags %>
6:
7: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8: <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
9: </head>
10:
(execjs):1
app/views/layouts/application.html.erb:7:in app_views_layouts_application_html_erb__652431424_78968160'
The application.html.erb file is this.
The controller was generated in the following way:
rails g controller Pages inicio
Environment:
Windows 10
Nodejs v8.1.2
Rails v5.1.1
Ruby v2.3.3
Thanks in advance.
per your error message, it looks like stylesheet problem (line 7) from your application layout, please check your stylesheets /app/assets/stylesheets/ make user your settings in application.css is correct

Rails 5: could not convert "application/vnd.ms-fontobject" to nil Error

I have problem when applying vendors assets on rails 5.0.0.1 on ruby 2.3.1.
I am getting this errors:
ActionView::Template::Error (could not convert "application/vnd.ms-fontobject" to nil):
4: <title>Inventory</title>
5: <%= csrf_meta_tags %>
6:
7: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8: <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
9:
10: </head>
app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__1205425238055745241_70060113419160'
Rendering /home/jerry/.rvm/gems/ruby-2.3.1#inventory/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout
Rendering /home/jerry/.rvm/gems/ruby-2.3.1#inventory/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered /home/jerry/.rvm/gems/ruby-2.3.1#inventory/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (3.1ms)
Rendering /home/jerry/.rvm/gems/ruby-2.3.1#inventory/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /home/jerry/.rvm/gems/ruby-2.3.1#inventory/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.3ms)
Rendering /home/jerry/.rvm/gems/ruby-2.3.1#inventory/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered /home/jerry/.rvm/gems/ruby-2.3.1#inventory/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.7ms)
Rendered /home/jerry/.rvm/gems/ruby-2.3.1#inventory/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (15.9ms)
I have add folder fonts on assets folder and add that to application.rb
I have searched on google with no luck.
What I did wrong, please?

Why rails isn't displaying a web page

Each time I launch a rails application, the server displays an error message. For instance (this is from the command line):
Started GET "/" for 127.0.0.1 at 2016-01-10 00:12:31 -0600
Processing by WelcomeController#index as HTML
Rendered welcome/index.html.erb within layouts/application (3.0ms)
Completed 500 Internal Server Error in 2054ms
ActionView::Template::Error (TypeError: Object doesn't support this property or method
(in c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/turbolinks-2.5.3/lib/assets/javascripts/turbolinks.js.coffee)):
3: <head>
4: <title>AlphaBlog</title>
5: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6: <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7: <%= csrf_meta_tags %>
8: </head>
9: <body>
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___602047428_59662224'
Rendered c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.0ms)
Rendered c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.0ms)
Rendered c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (64.8ms)
How do I fix this issue?
The first way to solve. Add to file application.js this line:
//= require turbolinks
The second method of solving. In Gemfile set version 1.8.0 for gem 'coffee-script-source' :
gem 'coffee-script-source', '1.8.0'
Try removing the javascript_include_tag (line indicated as broken) and see if the page loads. If the page does load, then it maybe something wrong with the assets files regarding javascript.

unable to import css in embedded ruby

hie
I tried to include #import "bootstrap"; in a file in stylesheets with name custom.css.scss
now on running the app i get the error as:
Started GET "/static_pages/about" for 127.0.0.1 at 2012-07-24 13:23:20 -0700
Processing by StaticPagesController#about as HTML
Rendered static_pages/about.html.erb within layouts/application (0.0ms)
Completed 500 Internal Server Error in 44ms
ActionView::Template::Error (different prefix: "C:/" and "D:/Rails/sample_app/ap
p/assets/stylesheets"
(in D:/Rails/sample_app/app/assets/stylesheets/custom.css.scss)):
2: <html>
3: <head>
4: <title><%= full_title(yield(:title)) %></title>
5: <%= stylesheet_link_tag "application", media: "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_ht
ml_erb___106293522_33950052'
Rendered C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6
/lib/action_dispatch/middleware/templates/rescues/_trace.erb (4.0ms)
Please advise how to fix it.
whatever you mean by the stuff that you are writing in your title, but i think that this problem is with your WIN setup: https://github.com/rails/rails/issues/660
I moved my application to the C:\ drive, where Rails is installed, to fix the issue.

Resources