【问题标题】:Heroku Slug Size Reduction - .slugignore issueHeroku Slug 大小减少 - .slugignore 问题
【发布时间】:2021-01-20 17:36:42
【问题描述】:

我又遇到了这个错误...我不记得我第一次尝试使用 .slugignore 文件时是如何修复的,以排除我不需要用于 slug 大小的主文件夹的东西是供应商,和节点模块,我用过

Heroku run bash -a businessappk3400
 »   Warning: Heroku update available from 7.42.5 to 7.42.8.
Running bash on ⬢ businessappk3400... up, run.8800 (Standard-1X)
~ $ du -sh * | sort -hr

得到了:

所以我正在考虑减少供应商和节点模块文件,我尝试将它们放在我在根文件夹中创建的 .slugignore 文件夹中,如下所示:

.slugignore:

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
./log
./tmp
./storage
./public
./node_modules
./yarn-error.log
./heroku
./vendor
./vendor/bundle
./kevin
./kevin.pug
./package-lock.json
./config/environments/database.yml
./package-lock.json
./vendor/database.yml
./public/packs
./public/packs-test
./yarn-error.log
./yarn-debug.log
.yarn-integrity

但我仍然通过了 slug 的 500mb 限制...有人解决了这个问题吗?

错误:

       WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
       Entrypoints:
         builder (1.02 MiB)
             js/builder-ba7328e435e703a663b7.js
       
       
       Asset precompilation completed (268.67s)
       Cleaning assets
       Running: rake assets:clean
-----> Detecting rails configuration
###### WARNING:
       You have not declared a Ruby version in your Gemfile.
       
       To declare a Ruby version add this line to your Gemfile:
       
       ```
       ruby "2.6.6"
       ```
       
       For more information see:
         https://devcenter.heroku.com/articles/ruby-versions
###### WARNING:
       Removing `Gemfile.lock` because it was generated on Windows.
       Bundler will do a full resolve so native gems are handled properly.
       This may result in unexpected gem versions being used in your app.
       In rare occasions Bundler may not be able to resolve your dependencies at all.
       https://devcenter.heroku.com/articles/bundler-windows-gemfile
###### WARNING:
       Detecting rails configuration failed
       set HEROKU_DEBUG_RAILS_RUNNER=1 to debug
-----> Discovering process types
       Procfile declares types     -> web, worker
       Default types for buildpack -> console, rake
-----> Compressing...
 !     Compiled slug size: 565.7M is too large (max is 500M).
 !     See: http://devcenter.heroku.com/articles/slug-size
 !     Push failed

完整的错误可以在这里找到:https://codepen.io/apesyntax/pen/oNLvWdB

【问题讨论】:

    标签: ruby-on-rails ruby heroku deployment slug


    【解决方案1】:

    此应用的分辨率为:

    使用 npm 卸载我们不需要或使用的模块...

    在部署应用程序时我们可以进行 slug 更改的唯一方法。

    我们之前尝试过,但没有成功:

    -恢复 Heroku 缓存 - 在 Linux 系统中重新生成 slug - 删除供应商文件夹 - 删除文件,完全不减少 Heroku -联系支持

    应用详情:

    红宝石 2.3.3 使用 webpack + webpacker

    【讨论】:

    • 你需要运行npm uninstall使用heroku bash吗?
    猜你喜欢
    • 2011-02-24
    • 1970-01-01
    • 2012-01-23
    • 2021-08-31
    • 1970-01-01
    • 1970-01-01
    • 2012-05-17
    • 2011-11-12
    • 1970-01-01
    相关资源
    最近更新 更多