Rails 7 SassC Error: Bootstrap not found or unreadable while uploading on Heroku - ruby-on-rails

I am upgrading my app from Rails 6.1 to Rails 7.
While testing it on development env., it works fine.
But I encouter an issue while uploading it on heroku.
Heroku raise this error while precompiling assets :
Running: rake assets:precompile
rake aborted!
SassC::SyntaxError: Error: File to import not found or unreadable: ../../../node_modules/bootstrap/scss/bootstrap.
on line 7:1 of app/assets/stylesheets/application.scss
>> #import "../../../node_modules/bootstrap/scss/bootstrap";
I've been trying many solutions from stackoverflow and ChatGPT :
Updating Gems with Bundle update / Bundle install
Updating 'bootstrap' gem
updating the path of bootstrap import line in my css file
clearing temp files
updating sassc
upgrading yarn | uninstalling/reinstalling boostratp with yarn
reinstalling dependencies with npm

Related

How to get webpacker to generate public/packs/manifest.json in a rails app

I am migrating a rails app to react. I followed webpacker instructions, but webpacker is not creating /public/packs/manifest.json file. If I create a new app, I works correctly. I have tried everything. Nothing is working. I am new to rails, so I don't know what I'm doing wrong. Here are the step that I perfromed:
Place in Gemfile
a. gem 'webpacker', '~> 3.5'; tried it without the second string and other version
b. gem 'react-rails'
bundle install
bundle exec rails webpacker:install
bundle exec rails webpacker:install:react
yarn add react-dom react-on-rails
rails generate react:install
Sys config
yarn - 1.22.10
webpack - 5.38.1
webpacker - 4.3.0
react-rails - 2.6.1
rails - 5.2.6
ruby - 2.6.6
THIS IS THE ERROR MESSAGE:
Webpacker can't find hello_react in /Users/lyte/Taichi_Project/taichi_school_v1/public/packs/manifest.json. Possible causes:
You want to set webpacker.yml value of compile to true for your environment
unless you are using the webpack -w or the webpack-dev-server.
webpack has not yet re-run to reflect updates.
You have misconfigured Webpacker's config/webpacker.yml file.
Your webpack configuration is not creating a manifest.
Your manifest contains:
{
}
Any suggestions would be appreciated.

After installing rails/webpacker, ./bin/webpack-watcher gives me an error

My rails app is currently on 5.0.1.
I've installed the rails/webpacker gem and generated the respective binstubs using the following command: bin/rails webpacker:install.
I've also installed webpack using yarn add --dev webpack.
Now, after running ./bin/webpack-watcher, I get the following error: sh: ./node_modules/webpack/bin/webpack.js: No such file or directory.
I admit, I'm brand new to webpack, so I don't know if I'm doing something in error. Any help is appreciated.
You are missing a lot of stuff. From the root of your rails application, open terminal and run:
bin/yarn add --dev webpack webpack-merge webpack-dev-server path-complete-extname babel-loader babel-core babel-preset-latest coffee-loader coffee-script rails-erb-loader glob
I'm pretty sure running bin/rails webpacker:install to an existing application will also run the above line.
The webpacker gem expects your node_modules, package.json, and yarn.lock file to be in the app's vendor folder. This will automatically be created for you during bin/rails webpacker:install if you have the yarn dependency management system installed.
cd ./vendor
yarn add --dev webpack

Sketchfab api data with Ruby

I am new to ruby. I am trying to upload a .STL file to Sketchfab using the code that they have provided on Sketchfab website.
https://gist.github.com/sbouafif/3736968#file-sketchfab-api-rb
I have installed the required gems including - gem install ruby-multipart-post
When I run:
bundle install
rake db:migrate
I get an error saying:
rake aborted!
cannot load such a file -- ruby-multipart-post
I have never had this issue when installing gems.
Any help would be great.
I am using Ruby 1.9.3.
Thanks
You don't install ruby-multipart-post gem as recommended in this line of script. Open terminal and install it use command:
gem install ruby-multipart-post

Start sidekiq bundler: command not found: sidekiq with mina - Spree

I have tried to deploy rails spree commerce project to ubuntu 14.04 server on digitalocean. Everything were well. But when I trying to deploy the project first time I get sidekiq error. I goggling something about that issue but I didn't get any solution.
after the
mina deploy
commad.
bundling and migrations work properly till the restarting of sidekiq.
The part of the deploying code which include the error is here:
-----> Launching
-----> Stop sidekiq
Skip stopping sidekiq (no pid file found)
-----> Start sidekiq
bundler: command not found: sidekiq
Install missing gem executables with `bundle install`
! ERROR: Deploy failed.
-----> Cleaning up build
Deleting release
Unlinking current
OK
I also experienced same problem when I execute command 'mina deploy' after I update version of mina. My workaround for this problem is by modifying my gemfile to return to the older version of
'kgio' to version 2.9.2
'mina' to version 0.3.1
'mina-sidekiq' to version 0.3.0
'mina-unicorn' to version 0.0.3
After that, it works again like before

Heroku Assests Precompile Issue

Recently I upgraded ruby version of my Heroku application after which it stopped compiling assets.
Initially I was using ruby version 1.9.2 and my assets were getting compiled while deploying the application. Recently I upgraded ruby version to 1.9.3 by specifying in gem file and adding config variable "RUBY_VERSION" for my application.
Everything is working fine now it is also picking right ruby version but it is not running assets precompile command while deploying application.
I have following line in application.rb
config.assets.enabled = true
A quick 'fix' for this would be precompiling the assets locally and then deploying the application.
I think its better, for a faster deployment.
First
rake assets:clean
then
RACK_ENV=production rake assets:precompile

Resources