I'm building a Rails 5.1.x rails app with jQuery
and a few other libraries. Rails is insisting on having Yarn on, which is fine on development machine but I cannot have it on production.
Is there a way to not have rails use Yarn by default? Remove yarn.lock
and node_modules
and everything else that comes with it.
When you create a rails project, you can add --skip-yarn
as rails new app_path --skip-yarn
.
Remove the following lines from the files
bin/setup.rb and bin/update.rb
- # Install JavaScript dependencies if using Yarn
- system('bin/yarn')
config/initializers/assets.rb
# Add Yarn node_modules folder to the asset load path.
Rails.application.config.assets.paths << Rails.root.join('node_modules')