Webpacker::Manifest::MissingEntryError in .... localhost:3000/* errors - ruby-on-rails

system:
Ruby: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
Rails: Rails 6.0.2
OS: Windows to a VM (vagrant ssh -> to ubuntu machine : Linux vagrant-ubuntu-trusty-64 3.13.0-170-generic #220-Ubuntu SMP x86_64 GNU/Linux
when I run rails server -b 0.0.0.0 I can access localhost:3000 and see the Yay! You’re on Rails!
but when I attempt to navigate to localhost:3000/say/hello
the below error comes up in browser
Browser error:
Showing /files_on_your_computer/rails6tut/demo/app/views/layouts/application.html.erb where line #9 raised:
Webpacker can't find application in /files_on_your_computer/rails6tut/demo/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:
{
}
Extracted source (around line #9):
7
8
9
10
11
12
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>
<body>
Rails.root: /files_on_your_computer/rails6tut/demo
console error:
vagrant#vagrant-ubuntu-trusty-64:/files_on_your_computer/rails6tut/demo$ rails server -b 0.0.0.0 => Booting Puma
=> Rails 6.0.2 application starting in development
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Version 4.3.1 (ruby 2.6.5-p114), codename: Mysterious Traveller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
Started GET "/say/hello" for 10.0.2.2 at 2019-12-17 17:51:09 +0000
(1.5ms) SELECT sqlite_version(*)
Processing by SayController#hello as HTML
Rendering say/hello.html.erb within layouts/application
Rendered say/hello.html.erb within layouts/application (Duration: 4.3ms | Allocations: 271)
Completed 500 Internal Server Error in 115ms (ActiveRecord: 0.0ms | Allocations: 7431)
ActionView::Template::Error (Webpacker can't find application in /files_on_your_computer/rails6tut/demo/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:
{
}
):
6: <%= csp_meta_tag %>
7:
8: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
9: <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
10: </head>
11:
12: <body>
app/views/layouts/application.html.erb:9
Started GET "/" for 10.0.2.2 at 2019-12-17 17:54:56 +0000
Processing by Rails::WelcomeController#index as HTML
Rendering /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.2/lib/rails/templates/rails/welcome/index.html.erb
Rendered /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/railties-6.0.2/lib/rails/templates/rails/welcome/index.html.erb (Duration: 3.1ms | Allocations: 190)
Completed 200 OK in 6ms (Views: 5.4ms | ActiveRecord: 0.0ms | Allocations: 899)
I have seen some similar issues on heroku, but i am running this locally so I am a bit confuddled.
I am following the Agile Web Development with rails 6 book.

I faced the same issue, I was using the latest version of node v15.2.0 and switched to a lower version of node v14.8.0 and webpacker is working fine.
Reference: [https://github.com/rails/webpacker/issues/2779#issuecomment-727170370]

What I did here simply is comment out line number 9.
8:<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
9:<%#= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>

Related

Unexpected = in haml file after updating Ruby

I am running a rails application (rails: 4.2 and ruby 2.2.3). I am trying to update my ruby to 2.4.4 and have been able to successfully run bundle install. However, when I start the server and go to the home page of my application, I encounter a unexpected = in the application.html.haml file for this line:
= favicon_link_tag 'favicon.ico'
Has anyone here encountered an error like this?
P.S. if this question has been posted before can someone redirect me to it as I cannot find this problem.
%head
%base{:href => "/dashboard"}
%title Title Page
= favicon_link_tag 'favicon.ico'
= stylesheet_link_tag "application", :media => nil
= javascript_include_tag "application"
= csrf_meta_tags
%body{'ng-app'=>'thumper','ng-controller'=>'MainController'}
- if signed_in?
.navbar.navbar-inverse.navbar-fixed-top{:style => 'padding-top:0px;height: 30px;'}
.container
%button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse"}
%a.navbar-brand{:href => "/", :target => "_self"}
= image_tag "main_image.png", :style => 'width:65px;', :alt => 'company_name'
.navbar-collapse.collapse
%ul.nav.navbar-nav
%li
%a{:href => "/faq", :target => "_self"}
%i.fa.fa-lightbulb-o
FAQ
%li
This is my initial part of my application.html.haml file. I get the following error:
DEPRECATED: Please use restforce (https://github.com/ejholmes/restforce) instead.
=> Booting Thin
=> Rails 4.2.11 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Thin web server (v1.7.2 codename Bachmanity)
Maximum connections set to 1024
Listening on localhost:3000, CTRL+C to stop
Started GET "/testpage" for 127.0.0.1 at 2019-03-12 09:32:47 -0500
ActiveRecord::SchemaMigration Load (44.9ms) SELECT `schema_migrations`.* FROM `schema_migrations`
Processing by TestController#foo as HTML
HERE
Rendered test/foo.html within layouts/application (2.9ms)
Completed 500 Internal Server Error in 1964ms (ActiveRecord: 0.0ms)
ExecJS::RuntimeError - SyntaxError: [stdin]:959:20: unexpected =:
app/views/layouts/application.html.haml:7:in `_app_views_layouts_application_html_haml___861496224579637971_70314333220700'
app/lib/cors.rb:12:in `call'
app/lib/cors.rb:12:in `call'
Started POST "/__better_errors/1f18681361fed4ae/variables" for 127.0.0.1 at 2019-03-12 09:32:50 -0500
The web browser looks like this:

redmine upgrade to 3.4.4 not working [ActionView::Template::Error (undefined method `default_users_time_zone')]

Every thing worked fine for me with Redmine 3.3. Now I wanted to upgrade to 3.4.4 and Redmine is no longer running. I searched the internet but did not find the exact same problem. Similar problems where caused by plugins but I do not have any plugins installed. I use the Passenger Docker image of Redmine.
The logs give me the following error message:
Processing by WelcomeController#index as HTML
Current user: anonymous
Redirected to http://0.0.0.0/login?back_url=http%3A%2F%2F0.0.0.0%2F
Filter chain halted as :check_if_login_required rendered or redirected
Completed 302 Found in 60ms (ActiveRecord: 3.7ms)
App 179 stdout:
Started GET "/login?back_url=https%3A%2F%2Fredmine.mydomain.tld%2F" for 95.90.204.176 at 2018-03-14 19:10:26 +0000
Processing by AccountController#login as HTML
Parameters: {"back_url"=>"https://redmine.mydomain.tld/"}
Current user: anonymous
Rendered account/login.html.erb within layouts/base (24.1ms)
Completed 500 Internal Server Error in 219ms (ActiveRecord: 4.3ms)
ActionView::Template::Error (undefined method `default_users_time_zone' for #<Class:0x00000000055f2120>
Did you mean? default_users_hide_mail):
11: <%= favicon %>
12: <%= stylesheet_link_tag 'jquery/jquery-ui-1.11.0', 'application', 'responsive', :media => 'all' %>
13: <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
14: <%= javascript_heads %>
15: <%= heads_for_theme %>
16: <%= call_hook :view_layouts_base_html_head %>
17: <!-- page specific tags -->
app/models/user_preference.rb:44:in `initialize'
app/models/user.rb:949:in `pref'
app/helpers/application_helper.rb:1451:in `javascript_heads'
app/views/layouts/base.html.erb:14:in `_app_views_layouts_base_html_erb__2446195152155203147_36658300'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'
What could that be? I need to upgrade to 3.4 because I want to use a plugin but the plugin requires version 3.4 in use.
It was my fault! I did not copy every new settings file to my mounted config directory.

ActionView::Template::Error (defaults.js isn't precompiled)

Recently, I've been working on migrating my Ruby on Rails site, built on passenger, to a different server, and in the process upgrade rails from 2.3.2 to 3.2. I've installed all necessary gems, and I thought configured everything correctly, but when I go to my site, I get a "We're sorry, but something went wrong" message
I checked the production.log and this is the error message I got:
Connecting to database specified by database.yml
Started GET "/login/login" for ip_address at 2013-05-31 20:12:28 -0400
Processing by LoginController#login as HTML
Rendered login/login.html.erb within layouts/homepage (6.9ms)
Completed 500 Internal Server Error in 43ms
ActionView::Template::Error (defaults.js isn't precompiled):
6:<title>test test test</title>
7: <link rel="icon" type="image/png" href="/images/favicon.ico">
8: <link rel="SHORTCUT ICON" href="/images/favicon.ico"/>
9: <%= javascript_include_tag :defaults %>
10: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
11: <script type="text/javascript" >src="http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script>
12: <script type="text/javascript" src="/javascripts/jquery-ui->1.8.20.custom.min.js"></script> <%= stylesheet_link_tag 'home_styles', :media => >'Screen' %>
app/views/layouts/homepage.html.erb:9:in
_app_views_layouts_homepage_html_erb__3199970246383683518_43112000'
I'm still pretty new to Rails, so I'm currently at a bit of a loss what to do. Any help would be appreciated!
<%= javascript_include_tag :defaults %>
This tag is from Rails versions pre 3.1. Are you sure this is what you want to do?
In newer applications, this line is typically including the application JavaScript file instead:
<%= javascript_include_tag "application" %>
This is made possible due to the Asset Pipeline which you can learn about by reading The Asset Pipeline Guide.

token_error on heroku when I try to load Google API

I am using winston/google_visualr to create nice graphs to visualize statistics in my rails application.
It works fine on my locale system, but if I push it to heroku I get something like a token_error. The result is, that it shows only the Heroku page
We're sorry, but something went wrong.
My head section of application.html.erb looks like this
<head>
<title><%= full_title(yield(:title)) %></title>
<script src='http://www.google.com/jsapi'></script>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
This is the heroku log:
ActionView::Template::Error (Unexpected token name, expected punc (line: 13588, col: 3, pos: 384041)
at expect (/tmp/execjs20121119-2-qx6eku.js:977:40)
Error
at js_error (/tmp/execjs20121119-2-qx6eku.js:505:15)
at new JS_Parse_Error (/tmp/execjs20121119-2-qx6eku.js:497:22)
at token_error (/tmp/execjs20121119-2-qx6eku.js:961:17)
at expect_token (/tmp/execjs20121119-2-qx6eku.js:974:17)
at object_ (/tmp/execjs20121119-2-qx6eku.js:1365:56)
at /tmp/execjs20121119-2-qx6eku.js:1326:51
Completed 500 Internal Server Error in 4980ms
at croak (/tmp/execjs20121119-2-qx6eku.js:954:17)
at maybe_unary (/tmp/execjs20121119-2-qx6eku.js:1425:27)
at expr_ops (/tmp/execjs20121119-2-qx6eku.js:1452:32)
(in /app/app/assets/javascripts/application.js)):
6: <%= stylesheet_link_tag "application", :media => "all" %>
7: <%= javascript_include_tag "application" %>
8: <%= csrf_meta_tags %>
9: <%= render 'layouts/shim' %>
4: <title><%= full_title(yield(:title)) %></title>
5: <script src='http://www.google.com/jsapi'></script>
app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__1437494530852335371_34567960'
It looks like that the external script reference may be the reason. Do you have any idea how to implement this?
The demo implementation of the author of the googlevisualr rails extension on heroku works fine. Is there any configuration settings in heroku I need to consider?
Thanks for your help.
It took me a lot of tries but I found the issue.
The error happens if one of the included JS' has syntax errors, i.e. a missing semicolon.
In my Gemfile I didn't add version numbers to my gem '...'.
I was using the gem 'bootstrap-datepicker-rails' in version '0.6.21' for my development environment.
If you push to heroku all your gems will be installed again, with the newest available version. Since version 0.6.28 is the actual version it was installed on heroku. It may have a syntax error and it caused the above issue. So, it had nothing to do with the line
<script src='http://www.google.com/jsapi'></script>
I just corrected the line in my gemfile to the following and all was working then:
gem 'bootstrap-datepicker-rails', '0.6.21'

How to cache HAML files in /tmp directory?

I'm having an issue with HAML where it is attempting to write to a read-only filesystem (on a Heroku-deployed app).
I can only write to /tmp and /log. How can I configure HAML to write files to the /tmp directory?
Thanks!
Edit:
Output of actual error
Started GET "/" for <ip> at Sun Oct 03 13:19:42 -0700 2010
Processing by WelcomeController#index as HTML
Rendered welcome/index.html.haml within layouts/application (5.6ms)
Completed in 10ms
ActionView::Template::Error (Read-only file system - /disk1/home/slugs/305306_d9977a4_8922/mnt/public/stylesheets/.permissions_check.23729009697080.19743.369932 - Heroku has a read-only filesystem. See http://docs.heroku.com/constraints#read-only-filesystem):
3: %html
4: %head
5: %title= title
6: = stylesheet_link_tag "reset", "application", "grid", :cache => "base"
7: = javascript_include_tag :defaults
8: = csrf_meta_tag
9:
app/views/layouts/application.html.haml:6:in `_app_views_layouts_application_html_haml___661334860_23729045526060_0'
Like Mark commented, I think you mean SASS, not Haml. Here's how to use git commit-hooks to precompile your SASS before deploying to heroku.
EDIT: After full error was posted
Change
= stylesheet_link_tag "reset", "application", "grid", :cache => "base"
to
= stylesheet_link_tag "reset", "application", "grid"
The caching isn't HAML, it's RAILS, and it's doing this on first read.

Resources