如何使用Ruby运行构建包而不会超时

时间:2019-07-02 20:29:32

标签: ruby-on-rails ruby heroku

我正在尝试将我的第一个网站推到Heroku,但是一切都在超时,我不确定为什么。我没有很多会导致其超时的PDF,所以我挠头。

这是我在失败之前收到的错误:

       Cleaning up the bundler cache.
-----> Installing node-v10.15.3-linux-x64
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       Yarn executable was not detected in the system.
       Download Yarn at https://yarnpkg.com/en/docs/install
       I, [2019-07-02T19:46:47.794669 #1507]  INFO -- : Writing /tmp/build_cabc1b6e8756bc1d1d3a5bd1884ae5fc/public/assets/deli3-397a9ad3da4bc5ec1fba4e10d9e3907174bd0ffe42493e732d6fb61d7f7002d5.png
       I, [2019-07-02T19:46:47.797500 #1507]  INFO -- : Writing /tmp/build_cabc1b6e8756bc1d1d3a5bd1884ae5fc/public/assets/food/food-726680522246b17f86a014fae70f1450435edc64798f8262315c23ccf6fa5744.png
       I, [2019-07-02T19:46:47.799838 #1507]  INFO -- : Writing /tmp/build_cabc1b6e8756bc1d1d3a5bd1884ae5fc/public/assets/food/frying-pan-af3f7e894cee377789f12f96b9f0ab120e8af6aba0cf03b6f8c021f5dadfc704.png
       I, [2019-07-02T19:46:47.802089 #1507]  INFO -- : Writing /tmp/build_cabc1b6e8756bc1d1d3a5bd1884ae5fc/public/assets/food/package-ec6088618de7d2829802bdc57b1ba0de3562ebf11d2ee2588af3432992c254a2.png
       I, [2019-07-02T19:46:50.262020 #1507]  INFO -- : Writing /tmp/build_cabc1b6e8756bc1d1d3a5bd1884ae5fc/public/assets/application-867e786874a7ad085e8e8e6fa4fcdda94aa82c482156efe5a12c59dd8e564d3e.js
       I, [2019-07-02T19:46:50.262656 #1507]  INFO -- : Writing /tmp/build_cabc1b6e8756bc1d1d3a5bd1884ae5fc/public/assets/application-867e786874a7ad085e8e8e6fa4fcdda94aa82c482156efe5a12c59dd8e564d3e.js.gz
-----> Timed out running buildpack Ruby
 !     Timed out compiling app (18 minutes)
 !     See https://devcenter.heroku.com/articles/slug-compiler#time-limit

我认为这是因为使用@import的SCSS文件使预编译花费的时间太长。我在本地驱动器上运行了该命令,该命令到目前为止已经运行/挂起了20分钟。

$ RAILS_ENV=production bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke yarn:install (first_time)
** Execute yarn:install
yarn install v1.16.0
[1/4] ?  Resolving packages...
success Already up-to-date.
✨  Done in 0.04s.


1 个答案:

答案 0 :(得分:0)

以防万一有人遇到相同的问题,我已经找到了问题-我的CSS文件具有自定义的CSS-Grid,其中一些导致$ bundle exec rake assets:precompile RAILS_ENV=production挂起。我通过将.css文件内的CSS-Grid布局删除一个来解决问题的根源,从而解决了问题