JavaScript not working for Bootstrap 5 on Rails 7
Hello,
I have started learning Ruby on Rails recently. I came across your site when trying to figure out issue I am having when installing Bootstrap 5 with Rails 7.
The bootstrap framework is installed, but JavaScript is not working. (I tried with Navbar as per your video instructions, but drop-down does not work).
I did everything exactly as per instructions.
- Add cssbundling-rails to Gemfile with gem 'cssbundling-rails'
- Run $bundle install
- Run $rails css:install:bootstrap
Google Chrome terminal gives this error.
Uncaught TypeError: Failed to resolve module specifier "bootstrap". Relative references must start with either "/", "./", or "../".
I am just trying to learn Ruby and Rails. I do not know Javascript either, but I want to learn now. Can you please advise how to fix this?
Thanks in advance.
On Rails 7.0.1 Ruby 3.1.0, I had to run yarn
to fix some issues. Also changed package.json. Note that some current Ruby and Rails versions aren't compatible. My new Rails was rails new rails71a --j esbuild --css bootstrap --database postgresql
. Not sure what the tutorial used.
I have started learning Ruby on Rails recently. I came across your site when trying to figure out issue I am having when installing Bootstrap 5 with Rails 7.
The bootstrap framework is installed, but JavaScript is not working. (I tried with Navbar as per your video instructions, but drop-down does not work).
I did everything exactly as per instructions.
http://www.deanstank.net/