Heroku - Build fail "LoadError: canot load such file -- coffee_script"

Heroku - Build fail "LoadError: canot load such file -- coffee_script"

如标题所述,从我的 Gemfile 中删除 gem 'coffee-rails' 后,我无法在 Heroku 上完成构建。

下面是错误消息以及之前的几行,表明它正在删除 coffee-script。

remote:        Removing coffee-script (2.4.1)
remote:        Removing coffee-script-source (1.12.2)
remote:        Removing coffee-rails (4.2.2)
remote:        The latest bundler is 2.0.0.pre.3, but you are currently running 1.15.2.
remote:        To update, run `gem install bundler --pre`
remote: -----> Installing node-v8.10.0-linux-x64
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        Yarn executable was not detected in the system.
remote:        Download Yarn at https://yarnpkg.com/en/docs/install
remote:        rake aborted!
remote:        LoadError: cannot load such file -- coffee_script
remote:        /tmp/build_dc46e31874491817c9a77e17cf3ac4d1/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'

在我看来,这可能是 Heroku 上 Bootsnap 的问题。

我采取的步骤:

  1. 已删除 gem 'coffee-rails' 运行 bundle update .
  2. 根据此
  3. 删除了所有对咖啡脚本的引用
  4. 添加、提交并将更新的 Gemfile 和 Gemfile.lock 推送到我的 master 分支。
  5. 通过 bash 在 Heroku 上
  6. 运行 rake tmp:cache:clear
  7. 重启测功机

此时,我很想继续安装 gem,因为我已确认构建已通过。

任何帮助都会很棒。

编辑:我的暂存应用程序设置有同样的问题。简单地开始一个新的暂存 app/remote 就解决了这个问题,所以这就是为什么我倾向于缓存问题。

有完全相同的问题。正如您所提到的,缓存需要清除。为此

heroku repo:purge_cache
git push heroku master

如果你没有heroku repo,这是一个需要安装的插件。只需遵循 Heroku 指南中提到的那些步骤 here:

heroku plugins:install heroku-repo
heroku repo:purge_cache -a appname
git commit --allow-empty -m "Purge cache"
git push heroku master

现在应该可以正常工作了 注意 heroku repo:purge_cache 如果设置了遥控器,没有应用程序名称当然就足够了。