Created a new app with
rails new my_new_app -d postgresql -c sass
Added the sass script to package.json, generated a controller and a view, created the database and ran
yarn build:css --watch & rails s (SASS was not getting compiled without the first part)
At this point, I get
Sprockets::Rails::Helper::AssetNotFound in Home#index
The asset "application.js" is not present in the asset pipeline.
What am I missing?
Just run into the same problem,
Not sure if its the right approach or not, but what i did to make it work was to
And it worked.
Thanks. This helped with problem in Rails 6. Gave the clue I needed. Different path
Hey thanks for sharing this post i was having some issues is your issue solved because i am not getting mine answer.
I had the same problem but with bootstrap and I tried your solution but I got this :
2 dots mean folder that is one level higher than the current folder.
If you are using VScode you can copy relative path by just right clicking the file whose path you want.
//= link_tree ../images
//= link frontend.js
//= link frontend.css
//= link admin.css
//= link admin.js
//= link dashboard/application.css
//= link dashboard/application.js
thank you Abdullah . it worked like charm
also you can modify “package.json” like this
so then you can re- run this command
yarn run build
I’ve the same problem when i tring to start my project with: rails new project_name --css=bootstrap
I tried to reinstall ruby 3, rails 7, node, npm and npx. It didn’t solve. I’m going to try the answers below. I hope i handle it.
I think the problem is that you used npm instead of yarn. This means that webpack cannot compile the code generated. By default, the files generated, in Procfile.dev, you have:
js: yarn build --watch
either install yarn or if u want to use npm change this to:
js: npm run build -- --watch
npm install -D webpack-cli
the error should clear.