Home > front end >  The asset “application.js” is not present in the asset pipeline in rails 7
The asset “application.js” is not present in the asset pipeline in rails 7

Time:06-01

I started new project with rails 7 and ruby 3 : rails new erdemsproject --css=bootstrap $rails g controller page index (after that in routes: root “home#index” )

$rails s

And I’m giving a basic error in localhost’s red page: The asset “application.js” is not present in the asset pipeline. on the:

<%= javascript_include_tag “application”, “data-turbo-track”: “reload”, defer: true %>

What is the mistake? I installed yarn, npm, npx and ruby again and again. But didn't solve.

CodePudding user response:

For a rails 7 app initialize with css flag you need to run your project with:

./bin/dev

Because you need to build your css and js with cssbundling-rails and jsbundling-rails.

CodePudding user response:

It loooks rails 7 is not stable yet. I couldn't solve the problem. --css=bootstrap gives so much errors. I tried to fix more than 2 weeks. I'm going to switch rails 6 again. It was a little comlicated when i tried to use bootstrap 5 but there wasn't any problem like this.

My main reason to choose rails 7 is turbo and stimulus. Is it possible to use turbo and stimulus in rails 6?

  • Related