herokuにstaging環境を作り、デプロイしようとすると以下のエラーが出て成功しません。
ruby
1remote: yarn install v1.16.0 2remote: [1/4] Resolving packages... 3remote: [2/4] Fetching packages... 4remote: info fsevents@1.2.12: The platform "linux" is incompatible with this module. 5remote: info "fsevents@1.2.12" is an optional dependency and failed compatibility check. Excluding it from installation. 6remote: [3/4] Linking dependencies... 7remote: warning " > webpack-dev-server@3.10.3" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0". 8remote: warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0". 9remote: [4/4] Building fresh packages... 10remote: Done in 26.43s. 11remote: I, [2020-05-12T14:30:21.926517 #773] INFO -- : Writing /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/public/assets/application-acbbcf2b20b4733f9a58938d54f55206396bc493119f5d088ef0ecda5ccf9d82.js 12remote: I, [2020-05-12T14:30:21.926791 #773] INFO -- : Writing /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/public/assets/application-acbbcf2b20b4733f9a58938d54f55206396bc493119f5d088ef0ecda5ccf9d82.js.gz 13remote: I, [2020-05-12T14:30:21.928843 #773] INFO -- : Writing /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/public/assets/actiontext-8f4769a67d984eef16e806b8c7796898df4a231778524cbcc58938caa95ef1f3.css 14remote: I, [2020-05-12T14:30:21.929484 #773] INFO -- : Writing /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/public/assets/actiontext-8f4769a67d984eef16e806b8c7796898df4a231778524cbcc58938caa95ef1f3.css.gz 15remote: I, [2020-05-12T14:30:21.936307 #773] INFO -- : Writing /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/public/assets/application-cee0c5739406c64710f21ed0b4aff6d7a375d5673d9eaa6bdfa35b542273c921.css 16remote: I, [2020-05-12T14:30:21.936511 #773] INFO -- : Writing /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/public/assets/application-cee0c5739406c64710f21ed0b4aff6d7a375d5673d9eaa6bdfa35b542273c921.css.gz 17remote: I, [2020-05-12T14:30:21.980031 #773] INFO -- : Writing /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/public/assets/blog-495deb931acf2cb74325ce78a5e5f2ce96ffc5de2716ec1a14d4fc9eca31608e.css 18remote: I, [2020-05-12T14:30:21.980678 #773] INFO -- : Writing /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/public/assets/blog-495deb931acf2cb74325ce78a5e5f2ce96ffc5de2716ec1a14d4fc9eca31608e.css.gz 19remote: I, [2020-05-12T14:30:21.982207 #773] INFO -- : Writing /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/public/assets/mypage-fe56b933f1fae3c0cdc309e5d7b46d19d793fb24920854a91517f7753116ff6e.css 20remote: I, [2020-05-12T14:30:21.982694 #773] INFO -- : Writing /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/public/assets/mypage-fe56b933f1fae3c0cdc309e5d7b46d19d793fb24920854a91517f7753116ff6e.css.gz 21remote: rake aborted! 22remote: NoMethodError: undefined method `+' for nil:NilClass 23remote: /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/vendor/bundle/ruby/2.6.0/bundler/gems/webpacker-22ab02b7c84e/lib/webpacker/configuration.rb:31:in `additional_paths' 24remote: /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/vendor/bundle/ruby/2.6.0/bundler/gems/webpacker-22ab02b7c84e/lib/webpacker/configuration.rb:35:in `additional_paths_globbed' 25remote: /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/vendor/bundle/ruby/2.6.0/bundler/gems/webpacker-22ab02b7c84e/lib/webpacker/compiler.rb:93:in `default_watched_paths' 26remote: /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/vendor/bundle/ruby/2.6.0/bundler/gems/webpacker-22ab02b7c84e/lib/webpacker/compiler.rb:57:in `watched_files_digest' 27remote: /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/vendor/bundle/ruby/2.6.0/bundler/gems/webpacker-22ab02b7c84e/lib/webpacker/compiler.rb:38:in `fresh?' 28remote: /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/vendor/bundle/ruby/2.6.0/bundler/gems/webpacker-22ab02b7c84e/lib/webpacker/compiler.rb:43:in `stale?' 29remote: /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/vendor/bundle/ruby/2.6.0/bundler/gems/webpacker-22ab02b7c84e/lib/webpacker/compiler.rb:22:in `compile' 30remote: /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/vendor/bundle/ruby/2.6.0/bundler/gems/webpacker-22ab02b7c84e/lib/webpacker/commands.rb:51:in `compile' 31remote: /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/vendor/bundle/ruby/2.6.0/bundler/gems/webpacker-22ab02b7c84e/lib/webpacker.rb:35:in `compile' 32remote: /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/vendor/bundle/ruby/2.6.0/bundler/gems/webpacker-22ab02b7c84e/lib/tasks/webpacker/compile.rake:23:in `block (4 levels) in <main>' 33remote: /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/vendor/bundle/ruby/2.6.0/bundler/gems/webpacker-22ab02b7c84e/lib/webpacker.rb:28:in `ensure_log_goes_to_stdout' 34remote: /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/vendor/bundle/ruby/2.6.0/bundler/gems/webpacker-22ab02b7c84e/lib/tasks/webpacker/compile.rake:22:in `block (3 levels) in <main>' 35remote: /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/vendor/bundle/ruby/2.6.0/bundler/gems/webpacker-22ab02b7c84e/lib/webpacker.rb:20:in `with_node_env' 36remote: /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/vendor/bundle/ruby/2.6.0/bundler/gems/webpacker-22ab02b7c84e/lib/tasks/webpacker/compile.rake:21:in `block (2 levels) in <main>' 37remote: /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/vendor/bundle/ruby/2.6.0/bundler/gems/webpacker-22ab02b7c84e/lib/tasks/webpacker/compile.rake:14:in `block in enhance_assets_precompile' 38remote: /tmp/build_e7fcd7f45c9309a1194c26c5778da9b3/vendor/bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>' 39remote: Tasks: TOP => webpacker:compile 40remote: (See full trace by running task with --trace) 41remote: 42remote: ! 43remote: ! Precompiling assets failed. 44remote: ! 45remote: ! Push rejected, failed to compile Ruby app. 46remote: 47remote: ! Push failed 48remote: Verifying deploy... 49
「NoMethodError: undefined method `+' for nil:NilClass」とあるので、プロジェクト内を'+'の記述ミスがないか探しましたが、見つけることができず、
同じコードでproduction環境へはデプロイできるがstaging環境のみデプロイに失敗してしまうので、webpacker.ymlあたりが間違っているかもしれませんが、それを見つけられずにいます。
ruby
1default: &default 2 source_path: app/javascript 3 source_entry_path: packs 4 public_root_path: public 5 public_output_path: assets 6 cache_path: tmp/cache/webpacker 7 webpack_compile_output: true 8 9 resolved_paths: [] 10 11 cache_manifest: false 12 13 extract_css: false 14 15 static_assets_extensions: 16 - .jpg 17 - .jpeg 18 - .png 19 - .gif 20 - .tiff 21 - .ico 22 - .svg 23 - .eot 24 - .otf 25 - .ttf 26 - .woff 27 - .woff2 28 29 extensions: 30 - .mjs 31 - .js 32 - .sass 33 - .scss 34 - .css 35 - .module.sass 36 - .module.scss 37 - .module.css 38 - .png 39 - .svg 40 - .gif 41 - .jpeg 42 - .jpg 43 44development: 45 <<: *default 46 compile: true 47 48 # Reference: https://webpack.js.org/configuration/dev-server/ 49 dev_server: 50 https: false 51 host: localhost 52 port: 3035 53 public: localhost:3035 54 hmr: false 55 # Inline should be set to true if using HMR 56 inline: true 57 overlay: true 58 compress: true 59 disable_host_check: true 60 use_local_ip: false 61 quiet: false 62 pretty: false 63 headers: 64 'Access-Control-Allow-Origin': '*' 65 watch_options: 66 ignored: '**/node_modules/**' 67 68 69test: 70 <<: *default 71 compile: true 72 73 # Compile test packs to a separate directory 74 public_output_path: packs-test 75 76production: 77 <<: *default 78 79 compile: false 80 81 extract_css: true 82 83 cache_manifest: true 84 85staging: 86 <<: *default 87 88 compile: false 89 90 cache_manifest: true 91 92 public_output_path: packs-staging 93 94 public_root_path: public
他試したこと
rails assets:precompile
や
rails webpacker:install
は行い、
config.assets.compile = true
にしましたが、結果は同じでした。
どなたかわかる方おられましたら、ご教示いただけますと幸いです。
宜しくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。