Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error getting semantic-ui dropdowns to work on Rails app #95

Closed
mnyon-grandkru opened this issue Apr 30, 2023 · 8 comments
Closed

Error getting semantic-ui dropdowns to work on Rails app #95

mnyon-grandkru opened this issue Apr 30, 2023 · 8 comments
Labels

Comments

@mnyon-grandkru
Copy link
Owner

A new programmer is currently trying to get semantic-ui working with a Rails 6 and Ruby 3.2.2 app:

Hi. i am new to programming and have been following a course, as part of this i have just started a new project using rail 6.1.7.3 and ruby 3.2.2 with semantic-ui for styling. i can get semantic working but the dropdowns dont work. it seems packs/manifest.json is not being created

Error with empty manifest.json

ActionView::Template::Error (unexpected token at ''):
8: <%= csp_meta_tag %>
9:
10: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
11: <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
12:
13:
14:

app/views/layouts/application.html.erb:11

Error message with filled in manifest.json

Started GET "/packs/js/application-0777f7a506acd75b1bfd.js" for ::1 at 2023-04-30 21:26:03 +0100

ActionController::RoutingError (No route matches [GET] "/packs/js/application-0777f7a506acd75b1bfd.js"):

I've opened up a Rails 6.1.7.3 instance and will try to replicate.

@Spudos
Copy link

Spudos commented Apr 30, 2023

as far as i can understand the problem even though webpacker is installed public/packs/*.json files do not exist which is why i am getting the error when the page tries to load.

i can "fudge" it by creating a manifest.json fine and filling it with boiler plate code but then it looks for the other two .js files in public/packs and doesnt find them so the app runs but returns the error in the console and dropdowns dont work

@mnyon-grandkru
Copy link
Owner Author

mnyon-grandkru commented Apr 30, 2023

Ah, let's also add the repo while we're at it (updated to point to Spudos)

@Spudos
Copy link

Spudos commented May 1, 2023

further testing carried out......

i following the following steps to generate my app

rails 6.1.7.3 new appname

set up my root path in routes.rb

root 'home#index'

create my home_controller.rb and add

class HomeController < ApplicationController

end

then create a home folder in layouts and index.html.erb in there, adding some example text

rails s to run the server

go to localhost:3000

and i get the error

Webpacker can't find application.js in /Users/andypierce/Desktop/testy/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:
    {
    }

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>

i can get the app to run by creating the packs folder in public and making a manifest.json file and copying some boiler plate code in there but that is call other .js files that dont exist

i have tried installed yarn and webpacker but nothing seems to create the missing files

Conclusion - its something to do with how i am creating the app as its falling over at stage one by trying to call files in public/packs that dont exist

the repo of my app that doesnt work is [https://github.com/Spudos/chat]

@mnyon-grandkru
Copy link
Owner Author

hi @Spudos,

How was this resolved? Were you able to create a manifest.json that Rails accepts, or is this still a challenge?

@mnyon-grandkru
Copy link
Owner Author

Hi @Spudos

I was looking at your Gemfile and noticed that you don't have the sprockets-rails gem in the Gemfile. I'd try adding/installing that gem and see if that helps.

@Spudos
Copy link

Spudos commented May 9, 2023

ok i will try that.

I think it is my environment that is messed up, probably from installing several versions of rails and not using gemsets to split it all up

@mnyon-grandkru
Copy link
Owner Author

@Spudos Could you benefit from a screencast on using rvm to separate environments and setup to start? Since we're not due to meet until next week, I figured this may help when you have some downtime over the next few days: https://www.youtube.com/watch?v=cQVb7fHFjSM

@Spudos
Copy link

Spudos commented May 18, 2023

thanks i will watch that later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants