【问题标题】:Heroku - Build fail "LoadError: canot load such file -- coffee_script"Heroku - 构建失败“LoadError:无法加载此类文件--coffee_script”
【发布时间】:2019-05-29 11:37:00
【问题描述】:

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

以下是错误消息以及之前的几行表明它正在删除咖啡脚本。

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. 删除了所有对咖啡脚本的引用answer
  3. 已将更新的 Gemfile 和 Gemfile.lock 添加、提交并推送到我的主分支。
  4. 通过 bash 在 Heroku 上运行 rake tmp:cache:clear
  5. 重新启动测功机

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

任何帮助都会很棒。

编辑:我有暂存应用程序设置有同样的问题。只需启动一个新的暂存应用程序/远程即可解决问题,这就是我倾向于缓存问题的原因。

【问题讨论】:

  • 尝试删除tmp/cache/bootsnap-compile-cachetmp/cache/bootsnap-load-path-cache
  • @Tom 谢谢 - 我确实删除了这些,但它们会在 dyno 重新启动时重新创建。
  • 试试heroku repo:purge_cache
  • 我收到repo:purge_cache is not a heroku command
  • 最后也重新安装了 gem :(

标签: ruby-on-rails heroku assets


【解决方案1】:

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

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 没有应用程序的名称当然就足够了,如果设置了遥控器。

【讨论】:

  • 感谢您提供答案。
  • rake tmp:cache:clear via Bash 没有解决问题时,这也是我们所需要的。谢谢!
猜你喜欢
  • 2021-05-16
  • 2015-01-27
  • 1970-01-01
  • 2015-05-30
  • 2015-01-22
  • 2012-10-25
  • 2020-12-05
  • 2017-03-18
  • 2018-07-31
相关资源
最近更新 更多