1

所以我构建了一个基本的应用程序,然后我准备测试一个“生产”原型,它不会推送到 Heroku。虽然在本地运行良好。所以我运行了这些步骤,在每个步骤之后立即推送一个 git,在不同的目录中,发现是在我运行 hotwire:install 之后它失败了。

脚步:

Ruby version: 3.0.0
Rails Version 6.1.1

rails new yourapp -d PostgreSQL
cd yourapp
git add .
git commit -m "initial"
Heroku create yourapp
git push Heroku master
(you may need to run bundle lock to add linux support then another commit)
--push was successful

bundle add hotwire-rails
git add .
git commit -m "added hotwire gem"
git push Heroku master
--push was successful

rails hotwire:install
bundle install
git add .
git commit -m "ran hotwire install"
git push Heroku master
--push rejected.  See output below.


patrick@Patricks-MBP chatapp2 % git push heroku master
Enumerating objects: 28, done.
Counting objects: 100% (28/28), done.
Delta compression using up to 12 threads
Compressing objects: 100% (15/15), done.
Writing objects: 100% (17/17), 2.60 KiB | 532.00 KiB/s, done.
Total 17 (delta 11), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.1.4
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-3.0.0
remote: -----> Installing dependencies using bundler 2.1.4
remote:        Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote:        Fetching gem metadata from https://rubygems.org/............
remote:        Using rake 13.0.3
remote:        Using concurrent-ruby 1.1.8
remote:        Using minitest 5.14.3
remote:        Using zeitwerk 2.4.2
remote:        Using builder 3.2.4
remote:        Using erubi 1.10.0
remote:        Using racc 1.5.2
remote:        Using crass 1.0.6
remote:        Using rack 2.2.3
remote:        Using nio4r 2.5.4
remote:        Using websocket-extensions 0.1.5
remote:        Using mimemagic 0.3.5
remote:        Using mini_mime 1.0.2
remote:        Using msgpack 1.3.3
remote:        Using bundler 2.2.3
remote:        Using ffi 1.14.2
remote:        Using method_source 1.0.0
remote:        Using thor 1.1.0
remote:        Using pg 1.2.3
remote:        Fetching redis 4.2.5
remote:        Using tilt 2.0.10
remote:        Using i18n 1.8.7
remote:        Using semantic_range 2.3.1
remote:        Using tzinfo 2.0.4
remote:        Using marcel 0.3.3
remote:        Using mail 2.7.1
remote:        Using bootsnap 1.5.1
remote:        Using puma 5.1.1
remote:        Using sassc 2.4.0
remote:        Using nokogiri 1.11.1 (x86_64-linux)
remote:        Using rack-test 1.1.0
remote:        Using websocket-driver 0.7.3
remote:        Using sprockets 4.0.2
remote:        Using rack-proxy 0.6.5
remote:        Using activesupport 6.1.1
remote:        Using loofah 2.9.0
remote:        Using rails-dom-testing 2.0.3
remote:        Using globalid 0.4.2
remote:        Using activemodel 6.1.1
remote:        Using jbuilder 2.11.1
remote:        Using rails-html-sanitizer 1.3.0
remote:        Using activejob 6.1.1
remote:        Using activerecord 6.1.1
remote:        Using actionview 6.1.1
remote:        Installing redis 4.2.5
remote:        Using actionpack 6.1.1
remote:        Using actioncable 6.1.1
remote:        Using activestorage 6.1.1
remote:        Using actionmailer 6.1.1
remote:        Using railties 6.1.1
remote:        Using sprockets-rails 3.2.2
remote:        Using actionmailbox 6.1.1
remote:        Using actiontext 6.1.1
remote:        Using sassc-rails 2.1.2
remote:        Using webpacker 5.2.1
remote:        Using rails 6.1.1
remote:        Using sass-rails 6.0.0
remote:        Using stimulus-rails 0.2.2
remote:        Using turbo-rails 0.5.7
remote:        Using hotwire-rails 0.1.3
remote:        Bundle complete! 18 Gemfile dependencies, 59 gems now installed.
remote:        Gems in the groups development and test were not installed.
remote:        Bundled gems are installed into `./vendor/bundle`
remote:        Removing bundler (2.1.4)
remote:        Removing turbolinks (5.2.1)
remote:        Removing turbolinks-source (5.2.0)
remote:        Bundle completed (3.08s)
remote:        Cleaning up the bundler cache.
remote: -----> Installing node-v12.16.2-linux-x64
remote: -----> Installing yarn-v1.22.4
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        yarn install v1.22.4
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        info fsevents@2.3.1: The platform "linux" is incompatible with this module.
remote:        info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.
remote:        info fsevents@1.2.13: The platform "linux" is incompatible with this module.
remote:        info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
remote:        [3/4] Linking dependencies...
remote:        warning " > webpack-dev-server@3.11.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
remote:        warning "webpack-dev-server > webpack-dev-middleware@3.7.3" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
remote:        [4/4] Building fresh packages...
remote:        Done in 26.86s.
remote:        Compiling...
remote:        Compilation failed:
remote:        ModuleNotFoundError: Module not found: Error: Can't resolve 'controllers' in '/tmp/build_aa8db0c8/app/javascript/packs'
remote:            at /tmp/build_aa8db0c8/node_modules/webpack/lib/Compilation.js:925:10
remote:            at /tmp/build_aa8db0c8/node_modules/webpack/lib/NormalModuleFactory.js:401:22
remote:            at /tmp/build_aa8db0c8/node_modules/webpack/lib/NormalModuleFactory.js:130:21
remote:            at /tmp/build_aa8db0c8/node_modules/webpack/lib/NormalModuleFactory.js:224:22
remote:            at /tmp/build_aa8db0c8/node_modules/neo-async/async.js:2830:7
remote:            at /tmp/build_aa8db0c8/node_modules/neo-async/async.js:6877:13
remote:            at /tmp/build_aa8db0c8/node_modules/webpack/lib/NormalModuleFactory.js:214:25
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/Resolver.js:213:14
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/Resolver.js:285:5
remote:            at eval (eval at create (/tmp/build_aa8db0c8/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/Resolver.js:285:5
remote:            at eval (eval at create (/tmp/build_aa8db0c8/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/Resolver.js:285:5
remote:            at eval (eval at create (/tmp/build_aa8db0c8/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/Resolver.js:285:5
remote:            at eval (eval at create (/tmp/build_aa8db0c8/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:41:1)
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:30:40
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/Resolver.js:285:5
remote:            at eval (eval at create (/tmp/build_aa8db0c8/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/Resolver.js:285:5
remote:            at eval (eval at create (/tmp/build_aa8db0c8/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:14:1)
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/forEachBail.js:30:14
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/Resolver.js:285:5
remote:            at eval (eval at create (/tmp/build_aa8db0c8/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/Resolver.js:285:5
remote:            at eval (eval at create (/tmp/build_aa8db0c8/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/Resolver.js:285:5
remote:            at eval (eval at create (/tmp/build_aa8db0c8/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:25:1)
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/Resolver.js:285:5
remote:            at eval (eval at create (/tmp/build_aa8db0c8/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:14:1)
remote:            at /tmp/build_aa8db0c8/node_modules/enhanced-resolve/lib/RootPlugin.js:37:38
remote:            at _next42 (eval at create (/tmp/build_aa8db0c8/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
remote:        resolve 'controllers' in '/tmp/build_aa8db0c8/app/javascript/packs'
remote:          Parsed request is a module
remote:          using description file: /tmp/build_aa8db0c8/package.json (relative path: ./app/javascript/packs)
remote:            Field 'browser' doesn't contain a valid alias configuration
remote:            resolve as module
remote:              looking for modules in /tmp/build_aa8db0c8/app/javascript
remote:                using description file: /tmp/build_aa8db0c8/package.json (relative path: ./app/javascript)
remote:                  Field 'browser' doesn't contain a valid alias configuration
remote:                  using description file: /tmp/build_aa8db0c8/package.json (relative path: ./app/javascript/controllers)
remote:                    no extension
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/app/javascript/controllers is not a file
remote:                    .mjs
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/app/javascript/controllers.mjs doesn't exist
remote:                    .js
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/app/javascript/controllers.js doesn't exist
remote:                    .sass
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/app/javascript/controllers.sass doesn't exist
remote:                    .scss
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/app/javascript/controllers.scss doesn't exist
remote:                    .css
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/app/javascript/controllers.css doesn't exist
remote:                    .module.sass
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/app/javascript/controllers.module.sass doesn't exist
remote:                    .module.scss
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/app/javascript/controllers.module.scss doesn't exist
remote:                    .module.css
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/app/javascript/controllers.module.css doesn't exist
remote:                    .png
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/app/javascript/controllers.png doesn't exist
remote:                    .svg
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/app/javascript/controllers.svg doesn't exist
remote:                    .gif
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/app/javascript/controllers.gif doesn't exist
remote:                    .jpeg
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/app/javascript/controllers.jpeg doesn't exist
remote:                    .jpg
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/app/javascript/controllers.jpg doesn't exist
remote:                    as directory
remote:                      existing directory
remote:                        using path: /tmp/build_aa8db0c8/app/javascript/controllers/index
remote:                          using description file: /tmp/build_aa8db0c8/package.json (relative path: ./app/javascript/controllers/index)
remote:                            no extension
remote:                              Field 'browser' doesn't contain a valid alias configuration
remote:                              /tmp/build_aa8db0c8/app/javascript/controllers/index doesn't exist
remote:                            .mjs
remote:                              Field 'browser' doesn't contain a valid alias configuration
remote:                              /tmp/build_aa8db0c8/app/javascript/controllers/index.mjs doesn't exist
remote:                            .js
remote:                              Field 'browser' doesn't contain a valid alias configuration
remote:                              /tmp/build_aa8db0c8/app/javascript/controllers/index.js doesn't exist
remote:                            .sass
remote:                              Field 'browser' doesn't contain a valid alias configuration
remote:                              /tmp/build_aa8db0c8/app/javascript/controllers/index.sass doesn't exist
remote:                            .scss
remote:                              Field 'browser' doesn't contain a valid alias configuration
remote:                              /tmp/build_aa8db0c8/app/javascript/controllers/index.scss doesn't exist
remote:                            .css
remote:                              Field 'browser' doesn't contain a valid alias configuration
remote:                              /tmp/build_aa8db0c8/app/javascript/controllers/index.css doesn't exist
remote:                            .module.sass
remote:                              Field 'browser' doesn't contain a valid alias configuration
remote:                              /tmp/build_aa8db0c8/app/javascript/controllers/index.module.sass doesn't exist
remote:                            .module.scss
remote:                              Field 'browser' doesn't contain a valid alias configuration
remote:                              /tmp/build_aa8db0c8/app/javascript/controllers/index.module.scss doesn't exist
remote:                            .module.css
remote:                              Field 'browser' doesn't contain a valid alias configuration
remote:                              /tmp/build_aa8db0c8/app/javascript/controllers/index.module.css doesn't exist
remote:                            .png
remote:                              Field 'browser' doesn't contain a valid alias configuration
remote:                              /tmp/build_aa8db0c8/app/javascript/controllers/index.png doesn't exist
remote:                            .svg
remote:                              Field 'browser' doesn't contain a valid alias configuration
remote:                              /tmp/build_aa8db0c8/app/javascript/controllers/index.svg doesn't exist
remote:                            .gif
remote:                              Field 'browser' doesn't contain a valid alias configuration
remote:                              /tmp/build_aa8db0c8/app/javascript/controllers/index.gif doesn't exist
remote:                            .jpeg
remote:                              Field 'browser' doesn't contain a valid alias configuration
remote:                              /tmp/build_aa8db0c8/app/javascript/controllers/index.jpeg doesn't exist
remote:                            .jpg
remote:                              Field 'browser' doesn't contain a valid alias configuration
remote:                              /tmp/build_aa8db0c8/app/javascript/controllers/index.jpg doesn't exist
remote:              /tmp/build_aa8db0c8/app/javascript/packs/node_modules doesn't exist or is not a directory
remote:              /tmp/build_aa8db0c8/app/javascript/node_modules doesn't exist or is not a directory
remote:              /tmp/build_aa8db0c8/app/node_modules doesn't exist or is not a directory
remote:              /tmp/node_modules doesn't exist or is not a directory
remote:              /node_modules doesn't exist or is not a directory
remote:              looking for modules in /tmp/build_aa8db0c8/node_modules
remote:                using description file: /tmp/build_aa8db0c8/package.json (relative path: ./node_modules)
remote:                  Field 'browser' doesn't contain a valid alias configuration
remote:                  using description file: /tmp/build_aa8db0c8/package.json (relative path: ./node_modules/controllers)
remote:                    no extension
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/node_modules/controllers doesn't exist
remote:                    .mjs
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/node_modules/controllers.mjs doesn't exist
remote:                    .js
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/node_modules/controllers.js doesn't exist
remote:                    .sass
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/node_modules/controllers.sass doesn't exist
remote:                    .scss
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/node_modules/controllers.scss doesn't exist
remote:                    .css
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/node_modules/controllers.css doesn't exist
remote:                    .module.sass
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/node_modules/controllers.module.sass doesn't exist
remote:                    .module.scss
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/node_modules/controllers.module.scss doesn't exist
remote:                    .module.css
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/node_modules/controllers.module.css doesn't exist
remote:                    .png
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/node_modules/controllers.png doesn't exist
remote:                    .svg
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/node_modules/controllers.svg doesn't exist
remote:                    .gif
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/node_modules/controllers.gif doesn't exist
remote:                    .jpeg
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/node_modules/controllers.jpeg doesn't exist
remote:                    .jpg
remote:                      Field 'browser' doesn't contain a valid alias configuration
remote:                      /tmp/build_aa8db0c8/node_modules/controllers.jpg doesn't exist
remote:                    as directory
remote:                      /tmp/build_aa8db0c8/node_modules/controllers doesn't exist
remote:        
remote: 
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: 0beb51342bdb63474012846f517d2f5978f00b80
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 0beb51342bdb63474012846f517d2f5978f00b80
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote: 
remote: Verifying deploy...
remote: 
remote: !   Push rejected to chatapp4db.
remote: 
To https://git.heroku.com/chatapp4db.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/chatapp4db.git'

如果您能够确定问题,请告诉我。我可以看到这是一个模块错误,但它只发生在 hot-wire:install 上。

4

2 回答 2

1

因此,显然,当您这样做时hotwire:install,它也忽略了安装controllers模块。跑步yarn add controllers为我解决了这个问题。我还必须是 Heroku 的经过验证的用户才能包含 Heroku Redis Hobby Dev 计划,否则 Heroku 实例将完全崩溃,我不得不重新启动服务器。

于 2021-01-25T19:35:59.447 回答
0

我认为您需要安装 webpacker,似乎 node_module 文件夹不存在。安装 webpacker

bundle exec rails webpacker:install
于 2021-01-25T08:50:48.083 回答