'Ruby on Rails - javascript(s) folder and application.js missing

I'm new to Rails and trying to use some Javascript, but everywhere I go I see application.js mentioned, but it's nowhere to be found in my directories.

I followed the official guide and created a blog. But there is no javascript folder or application.js file under app/assets like I'm expecting.

I'm using Rails 7. During installation, I had errors with the tzinfo-data gem, but fixed it later.

Image of the newly created blog assets folder



Solution 1:[1]

This is what I did. add gem Webpcker to Gem file ran bundle install ran webpacker:install The javascript folder was added under assets. Rails 7

Solution 2:[2]

Run this command. rails importmap:install.This should solve the problem.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 usmanzkhan
Solution 2 MUNEEB UL REHMAN