Heroku 构建失败:"can't find executable webpack for gem webpacker"

Heroku build failing: "can't find executable webpack for gem webpacker"

我的 Rails/React 应用程序在我部署到 Heroku 时失败了。情况并非总是如此。它只是在本地重新安装 Webpack 后才开始发生(对于不同的项目)。该应用程序在我的本地计算机上仍然可以正常运行。

我试过创建一个新的 Heroku 应用程序但没有成功,并尝试恢复到以前的工作提交,但由于某种原因现在也失败了。除了可能从 webpacker (3.2.0) 更改为 webpacker (3.3.1).

之外,变更日志中没有任何内容看起来会导致任何问题

这是 Heroku 构建日志的相关部分:

/tmp/build_f18e594f7966bd80b565c49de7015c56/zerovolts-kanjibenkyo-9786c55/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/rubygems_integration.rb:432:in `block in replace_bin_path': can't find executable webpack for gem webpacker (Gem::Exception)
from /tmp/build_f18e594f7966bd80b565c49de7015c56/zerovolts-kanjibenkyo-9786c55/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/rubygems_integration.rb:463:in `block in replace_bin_path'
from ./bin/webpack:21:in `<main>'

完整构建日志here

can't find executable webpack for gem webpacker (Gem::Exception)

基本上,可执行文件 bin/webpack 丢失了。

最简单的方法是 运行 rails new app --webpack 并转到新创建的应用程序目录,然后转到 app/bin 目录并将那些丢失的文件复制到您自己的项目中。

如果这能解决您的问题,请告诉我