Проблемы с развертыванием ruby на рельсах проекта к героку - PullRequest
0 голосов
/ 09 февраля 2020

Привет, я совершенно новичок в Heroku и столкнулся с некоторыми проблемами при развертывании моей реакции на приложение rails. Мне удалось развернуть мое веб-приложение, но оно выглядит совсем не так, как на локальном компьютере. CSS полностью испорчен и некоторые компоненты не отображаются, что выдает мне следующую ошибку. Я не понимаю, так как он отлично работает на моем локальном компьютере, но не работает при развертывании. Кто-нибудь может помочь?

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.6.5
-----> Vendoring libpq 5.12.1
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Installing dependencies using bundler 2.0.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
       Fetching gem metadata from https://rubygems.org/............
       Fetching rake 13.0.1
       Installing rake 13.0.1
       Fetching concurrent-ruby 1.1.5
       Fetching thread_safe 0.3.6
       Fetching minitest 5.14.0
       Installing minitest 5.14.0
       Installing thread_safe 0.3.6
       Installing concurrent-ruby 1.1.5
       Fetching zeitwerk 2.2.2
       Installing zeitwerk 2.2.2
       Fetching builder 3.2.4
       Fetching erubi 1.9.0
       Installing builder 3.2.4
       Installing erubi 1.9.0
       Fetching mini_portile2 2.4.0
       Installing mini_portile2 2.4.0
       Fetching crass 1.0.6
       Installing crass 1.0.6
       Fetching rack 2.2.0
       Fetching nio4r 2.5.2
       Installing nio4r 2.5.2 with native extensions
       Installing rack 2.2.0
       Fetching websocket-extensions 0.1.4
       Installing websocket-extensions 0.1.4
       Fetching mimemagic 0.3.4
       Installing mimemagic 0.3.4
       Fetching mini_mime 1.0.2
       Installing mini_mime 1.0.2
       Fetching public_suffix 4.0.3
       Fetching babel-source 5.8.35
       Installing public_suffix 4.0.3
       Installing babel-source 5.8.35
       Fetching execjs 2.7.0
       Fetching msgpack 1.3.3
       Installing msgpack 1.3.3 with native extensions
       Installing execjs 2.7.0
       Using bundler 2.0.2
       Fetching connection_pool 2.2.2
       Installing connection_pool 2.2.2
       Fetching ffi 1.12.2
       Installing ffi 1.12.2 with native extensions
       Fetching libv8 7.3.492.27.1 (x86_64-linux)
       Installing libv8 7.3.492.27.1 (x86_64-linux)
       Fetching method_source 0.9.2
       Installing method_source 0.9.2
       Fetching pg 1.2.2
       Installing pg 1.2.2 with native extensions
       Fetching thor 1.0.1
       Installing thor 1.0.1
       Fetching rainbow 3.0.0
       Installing rainbow 3.0.0
       Fetching tilt 2.0.10
       Installing tilt 2.0.10
       Fetching tzinfo 1.2.6
       Installing tzinfo 1.2.6
       Fetching nokogiri 1.10.7
       Installing nokogiri 1.10.7 with native extensions
       Fetching i18n 1.8.2
       Installing i18n 1.8.2
       Fetching websocket-driver 0.7.1
       Installing websocket-driver 0.7.1 with native extensions
       Fetching rack-test 1.1.0
       Installing rack-test 1.1.0
       Fetching rack-proxy 0.6.5
       Installing rack-proxy 0.6.5
       Fetching sprockets 4.0.0
       Installing sprockets 4.0.0
       Fetching mail 2.7.1
       Installing mail 2.7.1
       Fetching marcel 0.3.3
       Installing marcel 0.3.3
       Fetching addressable 2.7.0
       Installing addressable 2.7.0
       Fetching babel-transpiler 0.7.0
       Installing babel-transpiler 0.7.0
       Fetching puma 4.3.1
       Installing puma 4.3.1 with native extensions
       Fetching mini_racer 0.2.9
       Installing mini_racer 0.2.9 with native extensions
       Fetching bootsnap 1.4.5
       Installing bootsnap 1.4.5 with native extensions
       Fetching sassc 2.2.1
       Installing sassc 2.2.1 with native extensions
       Fetching activesupport 6.0.2.1
       Installing activesupport 6.0.2.1
       Fetching loofah 2.4.0
       Installing loofah 2.4.0
       Fetching rails-dom-testing 2.0.3
       Installing rails-dom-testing 2.0.3
       Fetching globalid 0.4.2
       Installing globalid 0.4.2
       Fetching activemodel 6.0.2.1
       Installing activemodel 6.0.2.1
       Fetching jbuilder 2.9.1
       Fetching rails-html-sanitizer 1.3.0
       Installing jbuilder 2.9.1
       Installing rails-html-sanitizer 1.3.0
       Fetching activejob 6.0.2.1
       Installing activejob 6.0.2.1
       Fetching activerecord 6.0.2.1
       Fetching actionview 6.0.2.1
       Installing actionview 6.0.2.1
       Installing activerecord 6.0.2.1
       Fetching actionpack 6.0.2.1
       Installing actionpack 6.0.2.1
       Fetching actioncable 6.0.2.1
       Fetching activestorage 6.0.2.1
       Installing actioncable 6.0.2.1
       Installing activestorage 6.0.2.1
       Fetching actionmailer 6.0.2.1
       Installing actionmailer 6.0.2.1
       Fetching railties 6.0.2.1
       Fetching sprockets-rails 3.2.1
       Installing railties 6.0.2.1
       Installing sprockets-rails 3.2.1
       Fetching actionmailbox 6.0.2.1
       Installing actionmailbox 6.0.2.1
       Fetching actiontext 6.0.2.1
       Installing actiontext 6.0.2.1
       Fetching react-rails 2.6.1
       Fetching rails 6.0.2.1
       Installing rails 6.0.2.1
       Fetching webpacker 4.2.2
       Installing webpacker 4.2.2
       Installing react-rails 2.6.1
       Fetching react_on_rails 11.3.0
       Installing react_on_rails 11.3.0
       Fetching sassc-rails 2.1.2
       Installing sassc-rails 2.1.2
       Fetching sass-rails 6.0.0
       Installing sass-rails 6.0.0
       Bundle complete! 19 Gemfile dependencies, 66 gems now installed.
       Gems in the groups development and test were not installed.
       Bundled gems are installed into `./vendor/bundle`
       Post-install message from i18n:

       HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
       But that may break your application.

       If you are upgrading your Rails application from an older version of Rails:

       Please check your Rails app for 'config.i18n.fallbacks = true'.
       If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
       'config.i18n.fallbacks = [I18n.default_locale]'.
       If not, fallbacks will be broken in your app by I18n 1.1.x.

       If you are starting a NEW Rails application, you can ignore this notice.

       For more info see:
       https://github.com/svenfuchs/i18n/releases/tag/v1.1.0

       Post-install message from react_on_rails:

       --------------------------------------------------------------------------------
       Email contact@shakacode.com for access to our slack room and information about our "pro support plan"
       which supports better performance, via caching helpers and our node rendering server.
       --------------------------------------------------------------------------------
       Bundle completed (211.64s)
       Cleaning up the bundler cache.
-----> Installing node-v10.15.3-linux-x64
-----> Installing yarn-v1.16.0
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       cd "/tmp/build_60da91166a46afdcd073e3c7f8e69443" && RAILS_ENV=production NODE_ENV=production bin/yarn install && bin/webpack
       yarn install v1.16.0
       warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       info fsevents@1.2.11: The platform "linux" is incompatible with this module.
       info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
       [3/4] Linking dependencies...
       warning " > @babel/preset-react@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-display-name@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx-self@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx-source@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx > @babel/plugin-syntax-jsx@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning " > react-on-rails@11.3.0" has unmet peer dependency "js-yaml@>= 3.0.0".
       [4/4] Building fresh packages...
       Done in 27.62s.
       Hash: 6b5b48728e54a96fe3a5
       Version: webpack 4.41.5
       Time: 15585ms
       Built at: 02/08/2020 10:27:53 PM
                                                   Asset      Size              Chunks                         Chunk Names
                            css/application-5575d6d0.css  2.22 KiB         application  [emitted] [immutable]  application
                        css/application-5575d6d0.css.map  3.28 KiB         application  [emitted] [dev]        application
                       css/server_rendering-5575d6d0.css  2.22 KiB    server_rendering  [emitted] [immutable]  server_rendering
                   css/server_rendering-5575d6d0.css.map  3.29 KiB    server_rendering  [emitted] [dev]        server_rendering
                                  css/tasks-5575d6d0.css  2.21 KiB               tasks  [emitted] [immutable]  tasks
                              css/tasks-5575d6d0.css.map  3.28 KiB               tasks  [emitted] [dev]        tasks
                  js/application-93838e690186034578ba.js  2.16 MiB         application  [emitted] [immutable]  application
              js/application-93838e690186034578ba.js.map  2.36 MiB         application  [emitted] [dev]        application
           js/hello-world-bundle-eaf6e9f9e932a7be6d74.js  1.53 MiB  hello-world-bundle  [emitted] [immutable]  hello-world-bundle
       js/hello-world-bundle-eaf6e9f9e932a7be6d74.js.map  1.67 MiB  hello-world-bundle  [emitted] [dev]        hello-world-bundle
                  js/hello_react-ebfc298f98c8209f7824.js  1.19 MiB         hello_react  [emitted] [immutable]  hello_react
              js/hello_react-ebfc298f98c8209f7824.js.map  1.37 MiB         hello_react  [emitted] [dev]        hello_react
             js/server_rendering-92dc5cf13ab2f9902577.js   2.1 MiB    server_rendering  [emitted] [immutable]  server_rendering
         js/server_rendering-92dc5cf13ab2f9902577.js.map  2.28 MiB    server_rendering  [emitted] [dev]        server_rendering
                        js/tasks-d9284b17fe04056968e5.js  2.05 MiB               tasks  [emitted] [immutable]  tasks
                    js/tasks-d9284b17fe04056968e5.js.map   2.2 MiB               tasks  [emitted] [dev]        tasks
                                           manifest.json   2.6 KiB                      [emitted]              
                     media/images/home_icon-835a47b6.png  11.9 KiB                      [emitted]              
       Entrypoint application = css/application-5575d6d0.css js/application-93838e690186034578ba.js css/application-5575d6d0.css.map js/application-93838e690186034578ba.js.map
       Entrypoint hello_react = js/hello_react-ebfc298f98c8209f7824.js js/hello_react-ebfc298f98c8209f7824.js.map
       Entrypoint hello-world-bundle = js/hello-world-bundle-eaf6e9f9e932a7be6d74.js js/hello-world-bundle-eaf6e9f9e932a7be6d74.js.map
       Entrypoint server_rendering = css/server_rendering-5575d6d0.css js/server_rendering-92dc5cf13ab2f9902577.js css/server_rendering-5575d6d0.css.map js/server_rendering-92dc5cf13ab2f9902577.js.map
       Entrypoint tasks = css/tasks-5575d6d0.css js/tasks-d9284b17fe04056968e5.js css/tasks-5575d6d0.css.map js/tasks-d9284b17fe04056968e5.js.map
       [./app/assets/images/home_icon.png] 81 bytes {tasks} [built]
       [./app/javascript/App.js] 3.87 KiB {tasks} [built]
       [./app/javascript/Routes.js] 1.4 KiB {tasks} [built]
       [./app/javascript/channels sync recursive _channel\.js$] ./app/javascript/channels sync _channel\.js$ 160 bytes {application} [built]
       [./app/javascript/channels/index.js] 211 bytes {application} [built]
       [./app/javascript/components sync recursive ^\.\/.*$] ./app/javascript/components sync ^\.\/.*$ 615 bytes {application} {server_rendering} [built]
       [./app/javascript/packs/application.js] 936 bytes {application} [built]
       [./app/javascript/packs/hello-world-bundle.js] 235 bytes {hello-world-bundle} [built]
       [./app/javascript/packs/hello_react.jsx] 1010 bytes {hello_react} [built]
       [./app/javascript/packs/server_rendering.js] 301 bytes {server_rendering} [built]
       [./app/javascript/packs/tasks.js] 473 bytes {tasks} [built]
       [./node_modules/moment/locale sync recursive ^\.\/.*$] ./node_modules/moment/locale sync ^\.\/.*$ 3 KiB {application} {server_rendering} {tasks} [optional] [built]
       [./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 905 bytes {hello-world-bundle} {tasks} [built]
       [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 552 bytes {application} {server_rendering} {tasks} [built]
           + 320 hidden modules
       Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--6-1!node_modules/postcss-loader/src/index.js??ref--6-2!app/javascript/components/stylesheets/myStyles.css:
           Entrypoint mini-css-extract-plugin = *
              2 modules
       yarn install v1.16.0
       warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       info fsevents@1.2.11: The platform "linux" is incompatible with this module.
       info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
       [3/4] Linking dependencies...
       warning " > @babel/preset-react@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-display-name@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx-self@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx-source@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx > @babel/plugin-syntax-jsx@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning " > react-on-rails@11.3.0" has unmet peer dependency "js-yaml@>= 3.0.0".
       [4/4] Building fresh packages...
       Done in 6.87s.
       yarn install v1.16.0
       warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       info fsevents@1.2.11: The platform "linux" is incompatible with this module.
       info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
       [3/4] Linking dependencies...
       warning " > @babel/preset-react@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-display-name@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx-self@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx-source@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning "@babel/preset-react > @babel/plugin-transform-react-jsx > @babel/plugin-syntax-jsx@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
       warning " > react-on-rails@11.3.0" has unmet peer dependency "js-yaml@>= 3.0.0".
       [4/4] Building fresh packages...
       Done in 5.74s.
       I, [2020-02-08T22:28:07.176094 #1754]  INFO -- : Writing /tmp/build_60da91166a46afdcd073e3c7f8e69443/public/assets/manifest-9fe2c7cde1314bed4a64599d938c6aa1f20f95db4f2507c65861dd2e9aeda52e.js
       I, [2020-02-08T22:28:07.176386 #1754]  INFO -- : Writing /tmp/build_60da91166a46afdcd073e3c7f8e69443/public/assets/manifest-9fe2c7cde1314bed4a64599d938c6aa1f20f95db4f2507c65861dd2e9aeda52e.js.gz
       I, [2020-02-08T22:28:07.176612 #1754]  INFO -- : Writing /tmp/build_60da91166a46afdcd073e3c7f8e69443/public/assets/home_icon-52f246a7c78ca9e1f13c38b9a8daac4b22886d91068b90f0f7be4b763a8eb9a3.png
       I, [2020-02-08T22:28:07.177089 #1754]  INFO -- : Writing /tmp/build_60da91166a46afdcd073e3c7f8e69443/public/assets/star-1f9d9370899e4bf0784c65e48e30f9d92372b4fa2e8e7974c150a43d7686ac78.png
       I, [2020-02-08T22:28:07.177710 #1754]  INFO -- : Writing /tmp/build_60da91166a46afdcd073e3c7f8e69443/public/assets/application-5e6289f716758e43f0b7190a92183847b5aeaab1b4abe4fad4fc3d7a98d347d9.css
       I, [2020-02-08T22:28:07.177865 #1754]  INFO -- : Writing /tmp/build_60da91166a46afdcd073e3c7f8e69443/public/assets/application-5e6289f716758e43f0b7190a92183847b5aeaab1b4abe4fad4fc3d7a98d347d9.css.gz
       I, [2020-02-08T22:28:07.178056 #1754]  INFO -- : Writing /tmp/build_60da91166a46afdcd073e3c7f8e69443/public/assets/pages-5e6289f716758e43f0b7190a92183847b5aeaab1b4abe4fad4fc3d7a98d347d9.css
       I, [2020-02-08T22:28:07.178207 #1754]  INFO -- : Writing /tmp/build_60da91166a46afdcd073e3c7f8e69443/public/assets/pages-5e6289f716758e43f0b7190a92183847b5aeaab1b4abe4fad4fc3d7a98d347d9.css.gz
       I, [2020-02-08T22:28:07.178373 #1754]  INFO -- : Writing /tmp/build_60da91166a46afdcd073e3c7f8e69443/public/assets/tasks-5e6289f716758e43f0b7190a92183847b5aeaab1b4abe4fad4fc3d7a98d347d9.css
       I, [2020-02-08T22:28:07.178504 #1754]  INFO -- : Writing /tmp/build_60da91166a46afdcd073e3c7f8e69443/public/assets/tasks-5e6289f716758e43f0b7190a92183847b5aeaab1b4abe4fad4fc3d7a98d347d9.css.gz
       Asset precompilation completed (60.23s)
       Cleaning assets
       Running: rake assets:clean
-----> Detecting rails configuration
###### WARNING:
       Replacing libpq with version libpq 5.12.1

       This version includes a bug fix that can cause an exception
       on boot for applications with incorrectly configured connection
       values. For more information see:

         https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior

       If your application breaks you can rollback to your last build.
       You can also temporarially opt out of this behavior by setting:

       ```
       $ heroku config:set HEROKU_SKIP_LIBPQ12=1
       ```

       In the future libpq 5.12 will be the default on the platform and
       you will not be able to opt-out of the library. For more information see:

         https://devcenter.heroku.com/articles/libpq-5-12-1-breaking-connection-behavior
###### WARNING:
       You set your `config.assets.compile = true` in production.
       This can negatively impact the performance of your application.

       For more information can be found in this article:
         https://devcenter.heroku.com/articles/rails-asset-pipeline#compile-set-to-true-in-production

###### WARNING:
       You set your `config.active_storage.service` to :local in production.
       If you are uploading files to this app, they will not persist after the app
       is restarted, on one-off dynos, or if the app has multiple dynos.
       Heroku applications have an ephemeral file system. To
       persist uploaded files, please use a service such as S3 and update your Rails
       configuration.

       For more information can be found in this article:
         https://devcenter.heroku.com/articles/active-storage-on-heroku

###### WARNING:
       We detected that some binary dependencies required to
       use all the preview features of Active Storage are not
       present on this system.

       For more information please see:
         https://devcenter.heroku.com/articles/active-storage-on-heroku

###### WARNING:
       No Procfile detected, using the default web server.
       We recommend explicitly declaring how to boot your server process via a Procfile.
       https://devcenter.heroku.com/articles/ruby-default-web-server
-----> Discovering process types
       Procfile declares types     -> (none)
       Default types for buildpack -> console, rake, web
-----> Compressing...
       Done: 122.4M
-----> Launching...

Ответы [ 2 ]

1 голос
/ 09 февраля 2020

[решено] Я нашел проблему! Я создал свою собственную папку с таблицами стилей и поместил туда свой файл css для быстрого доступа из моих компонентов реагирования, но я не понял, что его нужно поместить в каталог assets / stylesheets. Все заработало после того, как я перевернул его и перестроил. Спасибо всем за помощь!

0 голосов
/ 09 февраля 2020

Если это проблема компонентов css или javascript, возможно, вам придется предварительно скомпилировать приложение rails на Heroku. Запустите

bundle exec rails assets:precompile

Добавьте и передайте изменения и снова разверните их на Heroku. Это должно работать.

Если у вас по-прежнему возникают проблемы, возможно, вам потребуется сказать нам, что именно появляется или каков ожидаемый результат.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...