微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Heroku子弹尺寸减小-.slugignore问题

如何解决Heroku子弹尺寸减小-.slugignore问题

我再次遇到此错误...我不记得我第一次尝试使用.slugignore文件排除某些我不需要主文件夹的东西时是如何解决的,该主文件夹是供应商,以及我使用的节点模块

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

得到了:

enter image description here

因此,我正在考虑减少供应商和节点模块文件,我尝试将它们放在在根文件夹中创建的.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

但是我还是通过了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

解决方法

此应用的分辨率为:

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

在部署应用程序时,我们可以改变主意的唯一方法。

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

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

应用程序详细信息:

Ruby 2.3.3 使用web pack + webpacker

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。