如何从Rails应用程序中完全删除webpack及其所有依赖项

时间:2018-03-05 10:13:12

标签: ruby-on-rails ruby heroku webpack webpack-dev-server

我使用包含webpack的this template创建了我的rails,我仍然在app / assets / javascript中编写我的javascript代码。我正在尝试将我的应用程序部署到heroku并且它一直失败,我收到此错误

  

“远程:
  /tmp/build_6f0656280cbbda40c5832ccb79fc1783/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/rubygems_integration.rb:432:in   `block in replace_bin_path':找不到gem的可执行webpack   webpacker(Gem :: Exception)“

我尝试了很多解决方案,但仍然无法将我的应用部署到Heroku。我想知道如何从我的应用程序中完全删除webpack及其所有依赖项,因为它对我的应用程序甚至没用

    source 'https://rubygems.org'
ruby '2.3.5'

gem 'figaro'
gem 'jbuilder', '~> 2.0'
gem 'puma'
gem 'rails', '5.1.4'
gem 'redis'
gem 'cloudinary'
gem 'carrierwave', '~> 1.2'
gem 'rails_admin', '~> 1.2'
group :production do
 gem 'pg', '~> 0.20'
end



gem 'autoprefixer-rails'
gem 'bootstrap-sass'
gem 'jquery-rails'
gem 'font-awesome-sass'
gem 'sass-rails'
gem 'simple_form'
gem 'turbolinks', '~> 5.0.0'
gem 'coffee-rails'

gem 'uglifier'
gem 'webpacker'
gem 'devise'
gem 'ransack'
gem 'trix'


gem "letter_opener", group: :development


group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'sqlite3'
end

group :development, :test do
  # gem 'binding_of_caller'
  # gem 'better_errors'
  gem 'pry-byebug'
  gem 'pry-rails'
  gem 'listen', '~> 3.0.5'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

1 个答案:

答案 0 :(得分:7)

  • 删除.bin/webpack或运行bundle exec rake rails:update:bin
  • 删除config/webpacker.yml
  • 删除config/webpack
  • 删除app/javascripts
  • config.webpacker.check_yarn_integrity = false
  • 中移除config/{development, test, production}.rb
  • 验证您的gemfile中没有webpacker并运行bundle installbundle clean

imho,不要使用生成器创建rails应用程序(除非它是您自己的)