質問編集履歴

3

内容追記。

2020/12/14 14:53

投稿

renren
renren

スコア48

test CHANGED
File without changes
test CHANGED
@@ -38,9 +38,15 @@
38
38
 
39
39
 
40
40
 
41
+ ・GitHubとHerokuのデフォルトブランチをmasterからmainに変更してみた
42
+
43
+ https://zenn.dev/hiro_y/articles/b0839b76b9f1f58f7e17
44
+
45
+
46
+
41
47
  ■状況
42
48
 
43
- 上記サイトを参考にherokuへのデプロイ設定をしポートフォリオ を作成しておりました。
49
+ 【初心者向け】railsアプリをherokuを使って確実にデプロイする方法【決定版】サイトを参考にherokuへのデプロイ設定をしポートフォリオ を作成しておりました。
44
50
 
45
51
  初回とポートフォリオ作成初期段階まではpushできていたのですが、現在はpushに失敗してしまいます。
46
52
 
@@ -64,314 +70,430 @@
64
70
 
65
71
  ・heroku restart実行。
66
72
 
67
- 上記サを参考に再度確認
73
+ 【初心者向け】railsアプリをherokuを使って確実にデプロする方法【決定版】を参考に再度確認
68
74
 
69
75
  →bin/bundleファイルの先頭に #!/usr/bin/env ruby が存在していないことを確認。(このファイルは何も触っていません)
70
76
 
71
-
77
+ ・GitHubとHerokuのデフォルトブランチをmasterからmainに変更してみたサイトを見つけ、開発途中アプリを消し、作り直しているので影響を受けたのでは?と考えデフォルトブランチをmainに変更。
78
+
79
+ git push heroku mainしたところ違うブランチで作業しているよというエラーが発生。
80
+
81
+ If you are developing on a branch and deploying via git you must run:git push heroku <branchname>:main
82
+
83
+ mainではないのブランチ直前のブランチ(herokuデプロイエラー用に作成していました)に移動しpush。下記エラーとなっております。
84
+
85
+
86
+
87
+ ```
88
+
89
+ ❯ git push heroku heroku_deploy_error:main
90
+
91
+ remote:
92
+
93
+ remote: -----> Node.js app detected
94
+
95
+ remote:
96
+
97
+ remote: -----> Creating runtime environment
98
+
99
+ remote:
100
+
101
+ remote: NPM_CONFIG_LOGLEVEL=error
102
+
103
+ remote: USE_YARN_CACHE=true
104
+
105
+ remote: NODE_ENV=production
106
+
107
+ remote: NODE_MODULES_CACHE=true
108
+
109
+ remote: NODE_VERBOSE=false
110
+
111
+ remote:
112
+
113
+ remote: -----> Installing binaries
114
+
115
+ remote: engines.node (package.json): unspecified
116
+
117
+ remote: engines.npm (package.json): unspecified (use default)
118
+
119
+ remote: engines.yarn (package.json): unspecified (use default)
120
+
121
+ remote:
122
+
123
+ remote: Resolving node version 12.x...
124
+
125
+ remote: Downloading and installing node 12.20.0...
126
+
127
+ remote: Using default npm version: 6.14.8
128
+
129
+ remote: Resolving yarn version 1.22.x...
130
+
131
+ remote: Downloading and installing yarn (1.22.10)
132
+
133
+ remote: Installed yarn 1.22.10
134
+
135
+ remote:
136
+
137
+ remote: -----> Installing dependencies
138
+
139
+ remote: Installing node modules (yarn.lock)
140
+
141
+ remote: yarn install v1.22.10
142
+
143
+ remote: [1/4] Resolving packages...
144
+
145
+ remote: [2/4] Fetching packages...
146
+
147
+ remote: info fsevents@2.1.3: The platform "linux" is incompatible with this module.
148
+
149
+ remote: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
150
+
151
+ remote: info fsevents@1.2.13: The platform "linux" is incompatible with this module.
152
+
153
+ remote: info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
154
+
155
+ remote: [3/4] Linking dependencies...
156
+
157
+ remote: warning " > webpack-dev-server@3.11.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
158
+
159
+ remote: warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".
160
+
161
+ remote: [4/4] Building fresh packages...
162
+
163
+ remote: Done in 29.66s.
164
+
165
+ remote:
166
+
167
+ remote: -----> Build
168
+
169
+ remote:
170
+
171
+ remote: -----> Pruning devDependencies
172
+
173
+ remote: yarn install v1.22.10
174
+
175
+ remote: [1/4] Resolving packages...
176
+
177
+ remote: [2/4] Fetching packages...
178
+
179
+ remote: info fsevents@2.1.3: The platform "linux" is incompatible with this module.
180
+
181
+ remote: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
182
+
183
+ remote: info fsevents@1.2.13: The platform "linux" is incompatible with this module.
184
+
185
+ remote: info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
186
+
187
+ remote: [3/4] Linking dependencies...
188
+
189
+ remote: warning " > webpack-dev-server@3.11.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
190
+
191
+ remote: warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".
192
+
193
+ remote: [4/4] Building fresh packages...
194
+
195
+ remote: warning Ignored scripts due to flag.
196
+
197
+ remote: Done in 5.90s.
198
+
199
+ remote:
200
+
201
+ remote: -----> Caching build
202
+
203
+ remote: - yarn cache
204
+
205
+ remote:
206
+
207
+ remote: -----> Build succeeded!
208
+
209
+ remote: ! Unmet dependencies don't fail yarn install but may cause runtime issues
210
+
211
+ remote: https://github.com/npm/npm/issues/7494
212
+
213
+ remote:
214
+
215
+ remote: -----> Ruby app detected
216
+
217
+ remote: -----> Installing bundler 2.1.4
218
+
219
+ remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
220
+
221
+ remote: -----> Compiling Ruby/Rails
222
+
223
+ remote: -----> Using Ruby version: ruby-2.6.6
224
+
225
+ remote: -----> Installing dependencies using bundler 2.1.4
226
+
227
+ remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
228
+
229
+ remote: /tmp/build_09e402e7/bin/bundle: line 1: require: command not found
230
+
231
+ remote: /tmp/build_09e402e7/bin/bundle: line 3: m: command not found
232
+
233
+ remote: /tmp/build_09e402e7/bin/bundle: line 4: module_function: command not found
234
+
235
+ remote: /tmp/build_09e402e7/bin/bundle: line 6: def: command not found
236
+
237
+ remote: /tmp/build_09e402e7/bin/bundle: line 7: syntax error near unexpected token `$PROGRAM_NAME'
238
+
239
+ remote: /tmp/build_09e402e7/bin/bundle: line 7: ` File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__)'
240
+
241
+ remote: Bundler Output: /tmp/build_09e402e7/bin/bundle: line 1: require: command not found
242
+
243
+ remote: /tmp/build_09e402e7/bin/bundle: line 3: m: command not found
244
+
245
+ remote: /tmp/build_09e402e7/bin/bundle: line 4: module_function: command not found
246
+
247
+ remote: /tmp/build_09e402e7/bin/bundle: line 6: def: command not found
248
+
249
+ remote: /tmp/build_09e402e7/bin/bundle: line 7: syntax error near unexpected token `$PROGRAM_NAME'
250
+
251
+ remote: /tmp/build_09e402e7/bin/bundle: line 7: ` File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__)'
252
+
253
+ remote:
254
+
255
+ remote: !
256
+
257
+ remote: ! Failed to install gems via Bundler.
258
+
259
+ remote: !
260
+
261
+ remote: ! Push rejected, failed to compile Ruby app.
262
+
263
+ remote:
264
+
265
+ remote: ! Push failed
266
+
267
+ remote: Verifying deploy...
268
+
269
+ remote:
270
+
271
+ remote: ! Push rejected to music-sns-app.
272
+
273
+ remote:
274
+
275
+ To https://git.heroku.com/music-sns-app.git
276
+
277
+ ! [remote rejected] heroku_deploy_error -> main (pre-receive hook declined)
278
+
279
+ error: failed to push some refs to 'https://git.heroku.com/music-sns-app.git'
72
280
 
73
281
 
74
282
 
75
283
  ```
76
284
 
285
+
286
+
77
- ❯ git push heroku master
287
+ bin/bundle
78
-
79
-
80
-
81
- remote: -----> Node.js app detected
82
-
83
- remote:
84
-
85
- remote: -----> Creating runtime environment
86
-
87
- remote:
88
-
89
- remote: NPM_CONFIG_LOGLEVEL=error
90
-
91
- remote: USE_YARN_CACHE=true
92
-
93
- remote: NODE_ENV=production
94
-
95
- remote: NODE_MODULES_CACHE=true
96
-
97
- remote: NODE_VERBOSE=false
98
-
99
- remote:
100
-
101
- remote: -----> Installing binaries
102
-
103
- remote: engines.node (package.json): unspecified
104
-
105
- remote: engines.npm (package.json): unspecified (use default)
106
-
107
- remote: engines.yarn (package.json): unspecified (use default)
108
-
109
- remote:
110
-
111
- remote: Resolving node version 12.x...
112
-
113
- remote: Downloading and installing node 12.20.0...
114
-
115
- remote: Using default npm version: 6.14.8
116
-
117
- remote: Resolving yarn version 1.22.x...
118
-
119
- remote: Downloading and installing yarn (1.22.10)
120
-
121
- remote: Installed yarn 1.22.10
122
-
123
- remote:
124
-
125
- remote: -----> Installing dependencies
126
-
127
- remote: Installing node modules (yarn.lock)
128
-
129
- remote: yarn install v1.22.10
130
-
131
- remote: [1/4] Resolving packages...
132
-
133
- remote: [2/4] Fetching packages...
134
-
135
- remote: info fsevents@2.1.3: The platform "linux" is incompatible with this module.
136
-
137
- remote: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
138
-
139
- remote: info fsevents@1.2.13: The platform "linux" is incompatible with this module.
140
-
141
- remote: info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
142
-
143
- remote: [3/4] Linking dependencies...
144
-
145
- remote: warning " > webpack-dev-server@3.11.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
146
-
147
- remote: warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".
148
-
149
- remote: [4/4] Building fresh packages...
150
-
151
- remote: Done in 29.76s.
152
-
153
- remote:
154
-
155
- remote: -----> Build
156
-
157
- remote:
158
-
159
- remote: -----> Pruning devDependencies
160
-
161
- remote: yarn install v1.22.10
162
-
163
- remote: [1/4] Resolving packages...
164
-
165
- remote: [2/4] Fetching packages...
166
-
167
- remote: info fsevents@2.1.3: The platform "linux" is incompatible with this module.
168
-
169
- remote: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
170
-
171
- remote: info fsevents@1.2.13: The platform "linux" is incompatible with this module.
172
-
173
- remote: info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
174
-
175
- remote: [3/4] Linking dependencies...
176
-
177
- remote: warning " > webpack-dev-server@3.11.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
178
-
179
- remote: warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".
180
-
181
- remote: [4/4] Building fresh packages...
182
-
183
- remote: warning Ignored scripts due to flag.
184
-
185
- remote: Done in 5.64s.
186
-
187
- remote:
188
-
189
- remote: -----> Caching build
190
-
191
- remote: - yarn cache
192
-
193
- remote:
194
-
195
- remote: -----> Build succeeded!
196
-
197
- remote: ! Unmet dependencies don't fail yarn install but may cause runtime issues
198
-
199
- remote: https://github.com/npm/npm/issues/7494
200
-
201
- remote:
202
-
203
- remote: -----> Ruby app detected
204
-
205
- remote: -----> Installing bundler 2.1.4
206
-
207
- remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
208
-
209
- remote: -----> Compiling Ruby/Rails
210
-
211
- remote: -----> Using Ruby version: ruby-2.6.6
212
-
213
- remote: -----> Installing dependencies using bundler 2.1.4
214
-
215
- remote: Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
216
-
217
- remote: /tmp/build_f36177b6/bin/bundle: line 1: require: command not found
218
-
219
- remote: /tmp/build_f36177b6/bin/bundle: line 3: m: command not found
220
-
221
- remote: /tmp/build_f36177b6/bin/bundle: line 4: module_function: command not found
222
-
223
- remote: /tmp/build_f36177b6/bin/bundle: line 6: def: command not found
224
-
225
- remote: /tmp/build_f36177b6/bin/bundle: line 7: syntax error near unexpected token `$PROGRAM_NAME'
226
-
227
- remote: /tmp/build_f36177b6/bin/bundle: line 7: ` File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__)'
228
-
229
- remote: Bundler Output: /tmp/build_f36177b6/bin/bundle: line 1: require: command not found
230
-
231
- remote: /tmp/build_f36177b6/bin/bundle: line 3: m: command not found
232
-
233
- remote: /tmp/build_f36177b6/bin/bundle: line 4: module_function: command not found
234
-
235
- remote: /tmp/build_f36177b6/bin/bundle: line 6: def: command not found
236
-
237
- remote: /tmp/build_f36177b6/bin/bundle: line 7: syntax error near unexpected token `$PROGRAM_NAME'
238
-
239
- remote: /tmp/build_f36177b6/bin/bundle: line 7: ` File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__)'
240
-
241
- remote:
242
-
243
- remote: !
244
-
245
- remote: ! Failed to install gems via Bundler.
246
-
247
- remote: !
248
-
249
- remote: ! Push rejected, failed to compile Ruby app.
250
-
251
- remote:
252
-
253
- remote: ! Push failed
254
-
255
- remote: Verifying deploy...
256
-
257
- remote:
258
-
259
- remote: ! Push rejected to music-sns-app.
260
-
261
- remote:
262
-
263
- To https://git.heroku.com/music-sns-app.git
264
-
265
- ! [remote rejected] master -> master (pre-receive hook declined)
266
-
267
- error: failed to push some refs to 'https://git.heroku.com/music-sns-app.git'
268
288
 
269
289
  ```
270
290
 
271
- ```gemfile
272
-
273
- source 'https://rubygems.org'
274
-
275
- git_source(:github) { |repo| "https://github.com/#{repo}.git" }
276
-
277
-
278
-
279
- ruby '2.6.6'
280
-
281
-
282
-
283
- gem 'rails', '~> 6.0.3', '>= 6.0.3.3'
284
-
285
- gem 'bcrypt'
286
-
287
- gem 'puma', '~> 4.1'
288
-
289
- gem 'sass-rails', '>= 6'
290
-
291
- gem 'webpacker', '~> 4.0'
292
-
293
- gem 'turbolinks', '~> 5'
294
-
295
- gem 'jbuilder', '~> 2.7'
296
-
297
- gem 'bootsnap', '>= 1.4.2', require: false
298
-
299
- gem 'bootstrap-sass'
300
-
301
- gem 'devise'
302
-
303
- gem 'faker'
304
-
305
- gem 'jquery-rails'
306
-
307
- gem 'will_paginate'
308
-
309
- gem 'bootstrap-will_paginate'
310
-
311
- gem 'carrierwave'
312
-
313
- gem "mini_magick"
314
-
315
- gem 'pry-rails'
316
-
317
-
318
-
319
- group :development, :test do
320
-
321
- gem "factory_bot_rails"
322
-
323
- gem 'rubocop-airbnb'
324
-
325
- gem 'rails-controller-testing'
326
-
327
- gem 'rspec-rails'
328
-
329
- gem 'sqlite3'
330
-
331
- gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
291
+ require "rubygems"
292
+
293
+
294
+
295
+ m = Module.new do
296
+
297
+ module_function
298
+
299
+
300
+
301
+ def invoked_as_script?
302
+
303
+ File.expand_path($PROGRAM_NAME) == File.expand_path(__FILE__)
304
+
305
+ end
306
+
307
+
308
+
309
+ def env_var_version
310
+
311
+ ENV["BUNDLER_VERSION"]
312
+
313
+ end
314
+
315
+
316
+
317
+ def cli_arg_version
318
+
319
+ return unless invoked_as_script? # don't want to hijack other binstubs
320
+
321
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
322
+
323
+ bundler_version = nil
324
+
325
+ update_index = nil
326
+
327
+ ARGV.each_with_index do |a, i|
328
+
329
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
330
+
331
+ bundler_version = a
332
+
333
+ end
334
+
335
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
336
+
337
+ bundler_version = Regexp.last_match(1)
338
+
339
+ update_index = i
340
+
341
+ end
342
+
343
+ bundler_version
344
+
345
+ end
346
+
347
+
348
+
349
+ def gemfile
350
+
351
+ gemfile = ENV["BUNDLE_GEMFILE"]
352
+
353
+ return gemfile if gemfile.present?
354
+
355
+
356
+
357
+ File.expand_path("../../Gemfile", __FILE__)
358
+
359
+ end
360
+
361
+
362
+
363
+ def lockfile
364
+
365
+ lockfile =
366
+
367
+ case File.basename(gemfile)
368
+
369
+ when "gems.rb" then gemfile.sub(/.rb$/, gemfile)
370
+
371
+ else "#{gemfile}.lock"
372
+
373
+ end
374
+
375
+ File.expand_path(lockfile)
376
+
377
+ end
378
+
379
+
380
+
381
+ def lockfile_version
382
+
383
+ return unless File.file?(lockfile)
384
+
385
+ lockfile_contents = File.read(lockfile)
386
+
387
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
388
+
389
+ Regexp.last_match(1)
390
+
391
+ end
392
+
393
+
394
+
395
+ def bundler_version
396
+
397
+ @bundler_version ||=
398
+
399
+ env_var_version || cli_arg_version ||
400
+
401
+ lockfile_version
402
+
403
+ end
404
+
405
+
406
+
407
+ def bundler_requirement
408
+
409
+ return "#{Gem::Requirement.default}.a" unless bundler_version
410
+
411
+
412
+
413
+ bundler_gem_version = Gem::Version.new(bundler_version)
414
+
415
+
416
+
417
+ requirement = bundler_gem_version.approximate_recommendation
418
+
419
+
420
+
421
+ return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
422
+
423
+
424
+
425
+ requirement += ".a" if bundler_gem_version.prerelease?
426
+
427
+
428
+
429
+ requirement
430
+
431
+ end
432
+
433
+
434
+
435
+ def load_bundler!
436
+
437
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
438
+
439
+
440
+
441
+ activate_bundler
442
+
443
+ end
444
+
445
+
446
+
447
+ def activate_bundler
448
+
449
+ gem_error = activation_error_handling do
450
+
451
+ gem "bundler", bundler_requirement
452
+
453
+ end
454
+
455
+ return if gem_error.nil?
456
+
457
+ require_error = activation_error_handling do
458
+
459
+ require "bundler/version"
460
+
461
+ end
462
+
463
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
464
+
465
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
466
+
467
+ exit 42
468
+
469
+ end
470
+
471
+
472
+
473
+ def activation_error_handling
474
+
475
+ yield
476
+
477
+ nil
478
+
479
+ rescue StandardError, LoadError => e
480
+
481
+ e
482
+
483
+ end
332
484
 
333
485
  end
334
486
 
335
487
 
336
488
 
337
- group :development do
489
+ m.load_bundler!
338
-
339
- gem 'spring-commands-rspec'
490
+
340
-
341
- gem 'web-console', '>= 3.3.0'
491
+
342
-
343
- gem 'listen', '~> 3.2'
492
+
344
-
345
- gem 'spring'
493
+ if m.invoked_as_script?
346
-
494
+
347
- gem 'spring-watcher-listen', '~> 2.0.0'
495
+ load Gem.bin_path("bundler", "bundle")
348
496
 
349
497
  end
350
498
 
351
-
352
-
353
- group :test do
354
-
355
- gem 'webdrivers'
356
-
357
- gem 'capybara', '>= 2.15'
358
-
359
- gem 'selenium-webdriver'
360
-
361
- end
362
-
363
-
364
-
365
- group :production do
366
-
367
- gem 'pg'
368
-
369
- gem 'fog'
370
-
371
- end
372
-
373
-
374
-
375
- gem 'tzinfo-data'
376
-
377
499
  ```

2

試したこと追記。

2020/12/14 14:52

投稿

renren
renren

スコア48

test CHANGED
File without changes
test CHANGED
@@ -50,6 +50,8 @@
50
50
 
51
51
  ・作業ブランチがmasterであることを確認。
52
52
 
53
+ ・bundle install --without production実行。
54
+
53
55
  ・git add -A → git commit ○○ → git push heroku master の抜けがないことを確認。
54
56
 
55
57
  ・heroku アプリ削除→再度作成しpush → 失敗

1

対処したことの追記

2020/12/14 13:48

投稿

renren
renren

スコア48

test CHANGED
@@ -1 +1 @@
1
- herokuにデプロイできない
1
+ herokuにデプロイできません
test CHANGED
@@ -1,14 +1,72 @@
1
+ お世話になっております。
2
+
1
- 表題りherokuにデプロイできず詰まっております。
3
+ 現在、railsにて転職活動用ポートフォリオの作成に取掛かって1ヶ月目なのですが、herokuにデプロイできず詰まっております。
4
+
2
-
5
+ 初歩的な質問で大変恐縮なのですが、色々と調査をしてみたのですが原因がわからない為、同じ現象に遭遇したことがある方、もしくは何か原因に対してお心当たりのある方がいらっしゃいましたら解決方法に関してアドバイス頂けないでしょうか。
6
+
7
+
8
+
3
-
9
+ ■解決したい課題
4
-
10
+
5
- 下記記事を参考設定いたまし
11
+ ・herokupushした
12
+
13
+
14
+
15
+ ■環境
16
+
17
+ ・端末:MacBook Air (2020/13インチ)
18
+
19
+ ・OS:macOS Catalina(10.15.7)
20
+
21
+ ・シェル:zsh
22
+
23
+ ・Ruby:2.6.6p146
24
+
25
+ ・Rails:6.0.3.4
26
+
27
+ ・ローカル環境:sqlite3
28
+
29
+ ・本番環境:PostgreSQL
30
+
31
+
32
+
33
+ ■参考にした記事
34
+
35
+ ・【初心者向け】railsアプリをherokuを使って確実にデプロイする方法【決定版】
6
36
 
7
37
  https://qiita.com/kazukimatsumoto/items/a0daa7281a3948701c39
8
38
 
9
39
 
10
40
 
41
+ ■状況
42
+
43
+ 上記サイトを参考にherokuへのデプロイ設定をしポートフォリオ を作成しておりました。
44
+
45
+ 初回とポートフォリオ作成初期段階まではpushできていたのですが、現在はpushに失敗してしまいます。
46
+
47
+
48
+
49
+ ■試したこと
50
+
51
+ ・作業ブランチがmasterであることを確認。
52
+
53
+ ・git add -A → git commit ○○ → git push heroku master の抜けがないことを確認。
54
+
55
+ ・heroku アプリ削除→再度作成しpush → 失敗
56
+
57
+ ・違うブランチで作業しているよというエラーが発生 → git push heroku master:main → 失敗
58
+
59
+ ・githubのデフォルトブランチをmain → masterに変更。
60
+
61
+ ・heroku logs → Build failedが発生。build pack確認 → 何も入っていなかったので、heroku/nodejs、heroku/rubyをインストール。heroku buildpacksでインストールが成功していることを確認。
62
+
11
- 何卒、よろしくお願いいたします
63
+ ・heroku restart実行
64
+
65
+ ・上記サイトを参考に再度確認
66
+
67
+ →bin/bundleファイルの先頭に #!/usr/bin/env ruby が存在していないことを確認。(このファイルは何も触っていません)
68
+
69
+
12
70
 
13
71
 
14
72
 
@@ -16,23 +74,7 @@
16
74
 
17
75
  ❯ git push heroku master
18
76
 
19
- Enumerating objects: 9421, done.
77
+
20
-
21
- Counting objects: 100% (9421/9421), done.
22
-
23
- Delta compression using up to 8 threads
24
-
25
- Compressing objects: 100% (8051/8051), done.
26
-
27
- Writing objects: 100% (9421/9421), 31.47 MiB | 149.00 KiB/s, done.
28
-
29
- Total 9421 (delta 2555), reused 6930 (delta 849), pack-reused 0
30
-
31
- remote: Compressing source files... done.
32
-
33
- remote: Building source:
34
-
35
- remote:
36
78
 
37
79
  remote: -----> Node.js app detected
38
80