I'm upgrading ruby, rails and the other gems of an old application built on ruby2 running on Heroku.
I made it to deploy to Heroku but HTTP ERROR 500 occurs.
the error log is this below
ActionView::Template::Error (login.js):
40: = image_tag "app_logo.png", id: "app_logo", alt: "app"
41:
42: %span#dest
43: = javascript_include_tag "login"
app/views/sessions/_login.html.haml:43
app/views/sessions/login.html.haml:1
When I commented out this part = javascript_include_tag "login"
no error is emitted but also nothing appeared on the application page.
If anyone have any idea to solve it share with me please.
thanks
Your HAML code can be translated like this :
%span#dest
= javascript_include_tag "login"
<span id="dest">
<script src="/assets/login.js"></script>
</span>
The error means that your application failed to load the /assets/login.js.
You should look there what have messed up.
Related
I am running rails 6, and I have an application is working fine on my local, but when I tried to update the new version to the remote (railway), it doesn't build.
I've been in this issue for very long time, I've tried many work arounds, such as adding /assets/
I am getting the following error:
"ActionView::Template::Error (The asset "icons.css" is not present in the asset pipeline."
Following is my deploy log, some print screens and what I've tried already
[2023-02-10T19:39:55.261020 #1] INFO -- : [bf97bf74-3cf5-4085-a60a-4194f1935b1e] Completed 500 Internal Server Error in 1206ms (ActiveRecord: 92.9ms | Allocations: 59127)
F, [2023-02-10T19:39:55.262199 #1] FATAL -- : [bf97bf74-3cf5-4085-a60a-4194f1935b1e]
[bf97bf74-3cf5-4085-a60a-4194f1935b1e] ActionView::Template::Error (The asset "icons.css" is not present in the asset pipeline.
):
[bf97bf74-3cf5-4085-a60a-4194f1935b1e] 30: <meta name="twitter:creator" content="">
[bf97bf74-3cf5-4085-a60a-4194f1935b1e] 31: <meta name="twitter:image:src" content="<%= #trip && #trip.try(:id) && #trip.avatar.attached? ? #trip.try(:id) && #trip.try(:avatar).try(:service_url) : "#{get_site_image}" %>">
[bf97bf74-3cf5-4085-a60a-4194f1935b1e] 32:
[bf97bf74-3cf5-4085-a60a-4194f1935b1e] 33: <%= stylesheet_link_tag "icons.css", "data-turbo-track": "reload" %>
[bf97bf74-3cf5-4085-a60a-4194f1935b1e] 34: <%= stylesheet_link_tag "tooltipster.css", "data-turbo-track": "reload" %>
[bf97bf74-3cf5-4085-a60a-4194f1935b1e] 35: <%= stylesheet_link_tag "tooltipster-light.css", "data-turbo-track": "reload" %>
[bf97bf74-3cf5-4085-a60a-4194f1935b1e] 36: <%= stylesheet_link_tag "animations.css", "data-turbo-track": "reload" %>
[bf97bf74-3cf5-4085-a60a-4194f1935b1e]
[bf97bf74-3cf5-4085-a60a-4194f1935b1e] app/views/layouts/application.html.erb:33
here is my application file:
first part app file
second part app file
here is my package file:
package file
here us my webpack.yml file
webpack.yml
it runs locally fine, not on remote!
I've tried many many things:
recompiling with rake assets:precompile
adding /assets/ from line 33 to 58
removing line 59 "<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> "
Got many message errors from line 90 onwards "ActionController::RoutingError (No route matches [GET] "/assets/javascript/plugins/custom_onepage.js"):
[ac8248e6-f859-4969-9b54-9368bc3999cb]" so I cleared with rake assets:clobber
When I've done that, I start to get "ActionController::RoutingError (No route matches [GET] "/assets/font-awesome.min.css")" for every single line i've added /assets/ in the beginning
Tried to remove the /assets/ and recompile again, still not working and I got stuck again on line 33.
does anyone know how can find an workaround? I've tried many things and I been stuck for 4 days
So I was using railway, and I've tried to start the building proccess by adding the command NODE_OPTIONS --openssl-legacy-provider, but although having set this command to start building it, it hasn't sorted any effect.
So after reading loads of threads and tried almost everything, I find out that I had to add that as an env from my project NODE_OPTIONS=openssl-legacy-provider then I've got everything working.
Everything is working perfectly locally but when I tried to put the app live I've got this error:
Showing /home/rails/app/views/layouts/application.html.erb where line #9 raised:
end of file reached
(in /home/rails/app/assets/stylesheets/global.css.scss)
this is line 9
<%= stylesheet_link_tag "application" %>
when I remove this line I get errors for javascript:
<%= javascript_include_tag "vendor/modernizr" %>
What is the issue and how can it be fixed?
Also not sure about the "end of file reached global.css.scss?"
below is this:
app/views/layouts/application.html.erb:9:in `_app_views_layouts_application_html_erb__92412405316489023_40891780'
app/controllers/site_controller.rb:42:in `index'
On line 42 is the word "render"
def index
render
end
Many thanks
It should have something to do with precompile. Try cleaning the asset precompile temp folder.
If that doesn't solve it, pl post the stack trace.
When I 'rails server' the localhost:3000 works in my browser (chrome). Here's the term:
tom#toms-ubuntu:~/rails_projects/routesapp$ rails s
=> Booting WEBrick
=> Rails 3.2.16 application starting in development on http://localhost:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2016-01-12 10:56:27] INFO WEBrick 1.3.1
[2016-01-12 10:56:27] INFO ruby 1.9.3 (2013-11-22) [x86_64-linux]
[2016-01-12 10:56:27] INFO WEBrick::HTTPServer#start: pid=4751 port=3000
But for localhost:3000/page/home the browser displays:
NoMethodError in Page#home
Showing /home/tom/rails_projects/routesapp/app/views/layouts/application.html.erb where line #5 raised:
undefined method `[]' for nil:NilClass
Extracted source (around line #5):
2: <html>
3: <head>
4: <title>Routesapp</title>
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
Rails.root: /home/tom/rails_projects/routesapp
Application Trace | Framework Trace | Full Trace
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___1001173571477850876_70164200470120'
I generated the html files shown in the routes.rb file below; the html files are located in app/views/page
Routesapp::Application.routes.draw do
get 'page/home'
get 'page/about'
get 'page/contact'
Any ideas, comments, suggestions will be much appreciated. This is new to me. Thanks
Since you're a beginner, let me explain.
Your pages are showing; you've got an error:
undefined method `[]' for nil:NilClass
This is a standard Ruby error - it means undeclared variable.
Since Ruby is Object Orientated, it assigns "nil" values to the NilClass -- meaning that you end up with strange errors.
--
Normally, with debugging, you'll be able to reference the line number, and see what the issue is.
Because you've not included your view, I can only suggest that you try removing the following lines as a test:
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
If these work to resolve the issue, you'll have to either populate app/assets/javascripts/application.js or app/assets/stylesheets/application.css, or use something like nodeJS which works to resolve errors like this.
You'll also be better using the following for your routes:
#config/routes.rb
resources :pages, path: "page", only: [] do
%w(home about contact).each do |page|
get page
end
end
Buddy take "application" on line #5 and #6 and change that "application" word to "defaults"
I successfully deployed my rails app to my VPS, but when I try to look at my server from browser, I get a 500 error ("We're sorry, but something's wrong"). The app is working fine locally, so I think the problem lies in not my code but somewhere else.
Here's the log from /current/log/production.log
ActionView::Template::Error (jquery.js isn't precompiled):
4: <title>Songhomme</title>
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= javascript_include_tag 'jquery' %>
8: <%= csrf_meta_tags %>
9: </head>
10: <body>
app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb___2525571063257357898_28769560'
I also got the following error:
ActionView::Template::Error (/home/deployer/apps/songhomme/releases/20121204091428/app/views/posts/_posts.erb:27: syntax error, unexpected ',', expecting ')'
...ppend= ( link_to (t.name + " ", '/tags/' + t.id.to_s) );#out...
The code is working fine locally, so I'm not sure what's wrong with the second part of code. For the first part of code, does running rake assets:precompile before I push to my repo solve the problem?
I appreciate your help.
Try declaring your js includes in the manifest file application.js , not by javascript_include_tag. Since Rails version 3 this is the proper way . So , in your application.js :
//= require jquery
//= require jquery_ujs
I've configured an Ubuntu server with passenger-install-apache2-module so that I can run several rails applications on one server. I've got a test application running which works fine using webbrick, but when I restart the apache server, I get the "We're sorry, but something went wrong" error. When I place a file in /public/index.html, that is rendered fine but as soon as the application relies on rails to generate content, I get the same error.
Where can I find the logs so I can find out more information? Or does anyone have a better idea?
UPDATE: I chmodded the log file, and now get this error in the production log:
Started GET "/users" for 77.100.43.95 at 2012-07-06 07:38:48 +0000
Processing by UsersController#index as HTML
Rendered users/index.html.erb within layouts/application (4.2ms)
Completed 500 Internal Server Error in 115ms
ActionView::Template::Error (application.css isn't precompiled):
2: <html>
3: <head>
4: <title>Max</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_html_erb___1047297680506537616_22545860'
app/controllers/users_controller.rb:7:in `index'
Thanks
Try running
bundle exec rake assets:precompile
from within the application directory. This should fix the error.