How to remove Yarn from a Rails app completely?

强颜欢笑 提交于 2019-12-11 15:41:24

问题


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.


回答1:


When you create a rails project, you can add --skip-yarn as rails new app_path --skip-yarn.




回答2:


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')


来源:https://stackoverflow.com/questions/52905703/how-to-remove-yarn-from-a-rails-app-completely

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!