0

I've recently upgraded to latest rails. The upgrade was from 6.0.3.4 to 6.1.3.1.

Everything in development and Production/Heroku worked great prior to the upgrade. Now everything works fine in development (local machine), but fails the rails assets:precompile step on Heroku with the following error message:

remote: -----> Installing node-v12.16.2-linux-x64
remote: -----> Installing yarn-v1.22.4
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        rake aborted!
remote:        SassC::SyntaxError: Error: File to import not found or unreadable: bootstrap/scss/bootstrap.
remote:                on line 21:1 of app/assets/stylesheets/application.scss
remote:        >> @import "bootstrap/scss/bootstrap";

My understanding is that the standard functionality is that it will look in local relative files first, then the node_modules folder.

What is my problem here?

karns
  • 5,391
  • 8
  • 35
  • 57

3 Answers3

0

probably the file under node_module and it was not able to find it

try specifying @import "node_modules/bootstrap/scss/bootstrap";

Mshka
  • 1,798
  • 1
  • 10
  • 19
  • Much appreciate your response - but why do you suspect it would have changed? – karns Apr 14 '21 at 17:43
  • Perhaps they removed the method of doing SASS via sprockets/asset pipeline in favor of using Webpack..? – karns Apr 14 '21 at 18:20
  • I do believe so, there is no official place I could find that stats this, but I've seen people report this in quite a few places (and not just 6.1) https://stackoverflow.com/a/63071803/5872935 – Mshka Apr 14 '21 at 18:34
  • I'm currently looking down a different path. Since it works in development, I don't feel that is my best path at this point. – karns Apr 14 '21 at 19:16
  • 1
    Mshka, I'm not sure why in the world this would be, but I had to go and explicitly set Heroku to use NodeJS buildpack in addition to ruby buildpack. Now, I did use webpack before upgrading to 6.1 and everything worked find when deploying, so I'm really confused on how Heroku built fine before. – karns Apr 14 '21 at 20:58
0

I'm not sure if I'm missing something, but I needed to add NodeJS buildpack to Heroku in addition to the ruby buildpack. Now Heroku runs the yarn install before building the rails app, which must create the node_modules folder. Consequently, the step that failed during the rails build can now find the bootstrap folder in the node_modules.

The only thing I can think of that I changed was upgrading from Rails 6.0 to 6.1.

karns
  • 5,391
  • 8
  • 35
  • 57
0

You can probably run test it locally

NODE_ENV=production bundle exec rails assets:precompile 

then run

rake assets:precompile
Elias Glyptis
  • 470
  • 5
  • 9