Home>

We become indebted to.
It's been one month since I started to create a portfolio for job change activities on rails, but I can't deploy it on heroku and I'm stuck.
I'm very sorry for the introductory question, but I've done various investigations, but I don't know the cause, so there are people who have encountered the same phenomenon or who have some idea of ​​the cause. Would you please give me some advice on how to solve it?

■ Issues I want to solve
・ I want to push to heroku

■ Environment
・ Terminal: MacBook Air (2020/13 inch)
・ OS: macOS Catalina (10.15.7)
・ Shell: zsh
・ Ruby: 2.6.6p146
・ Rails: 6.0.3.4
・ Local environment: sqlite3
-Production environment: PostgreSQL

■ Referenced articles
-[For beginners] How to reliably deploy rails apps using heroku [Definitive edition]
https://qiita.com/kazukimatsumoto/items/a0daa7281a3948701c39

・ I changed the default branch of GitHub and Heroku from master to main.
https://zenn.dev/hiro_y/articles/b0839b76b9f1f58f7e17

■ Situation
[For beginners] How to reliably deploy rails application using heroku [Definitive edition] I made a portfolio by setting deployment to heroku with reference to the site.
I was able to push until the first time and the initial stage of portfolio creation, but now it fails.

■ What I tried
-Check that the working branch is master.
-Execute bundle install --without production.
・ Git add -A → git commit ○ ○ → Confirm that there is no omission of git push heroku master.
・ Delete heroku app → Create again and push → Failure
・ I get an error saying that I'm working on a different branch → git push heroku master: main → Failed
-Changed the default branch of github from main to master.
・ Heroku logs → Build failed. Check build pack → Since nothing was included, install heroku/nodejs and heroku/ruby. Confirm that the installation is successful with heroku build packs.
-Execute heroku restart.
・ [For beginners] How to reliably deploy rails application using heroku [Definitive edition] Check again with reference to
→ Confirm that #!/Usr/bin/env ruby ​​does not exist at the beginning of the bin/bundle file. (I haven't touched anything in this file)
・ I found a site that changed the default branch of GitHub and Heroku from master to main, deleted the application under development, and recreated it, so was it affected? I changed the default branch to main.
When I git push heroku main, I get an error saying that I'm working on a different branch.
If i am developing on a branch and deploying via git you must run: git push heroku: main
Go to the branch just before the non-main branch (which I created for heroku deployment errors) and push. The following error has occurred.

❯ git push heroku heroku_deploy_error: main
remote: remote:
remote: ----->Node.js app detected
remote: remote:
remote: ----->Creating runtime environment
remote: remote:
remote: NPM_CONFIG_LOGLEVEL = error
remote: USE_YARN_CACHE = true
remote: NODE_ENV = production
remote: NODE_MODULES_CACHE = true
remote: NODE_VERBOSE = false
remote: remote:
remote: ----->Installing binaries
remote: engines.node (package.json): unspecified
remote: engines.npm (package.json): unspecified (use default)
remote: engines.yarn (package.json): unspecified (use default)
remote: remote:
remote: Resolving node version 12.x ...remote: Downloading and installing node 12.20.0 ...
remote: Using default npm version: 6.14.8
remote: Resolving yarn version 1.22.x ...
remote: Downloading and installing yarn (1.22.10)
remote: Installed yarn 1.22.10
remote: remote:
remote: ----->Installing dependencies
remote: Installing node modules (yarn.lock)
remote: yarn install v1.22.10
remote: [1/4] Resolving packages ...
remote: [2/4] Fetching packages ...
remote: info fsevents @ 2.1.3: The platform "linux" is incompatible with this module.
remote: info "fsevents @ 2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: info [email protected]: The platform "linux" is incompatible with this module.
remote: info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: [3/4] Linking dependencies ...
remote: warning ">[email protected]" has unmet peer dependency "[email protected]^ 4.0.0 || ^ 5.0.0".
remote: warning "webpack-dev-server>[email protected]" has unmet peer dependency "[email protected]^ 4.0.0".
remote: [4/4] Building fresh packages ...
remote: Done in 29.66s.
remote: remote:
remote: ----->Build
remote: remote:
remote: ----->Pruning devDependencies
remote: yarn install v1.22.10
remote: [1/4] Resolving packages ...
remote: [2/4] Fetching packages ...
remote: info fsevents @ 2.1.3: The platform "linux" is incompatible with this module.
remote: info "fsevents @ 2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: info [email protected]: The platform "linux" is incompatible with this module.
remote: info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: [3/4] Linking dependencies ...
remote: warning ">[email protected]" has unmet peer dependency "[email protected]^ 4.0.0 || ^ 5.0.0".
remote: warning "webpack-dev-server>[email protected]" has unmet peer dependency "[email protected]^ 4.0.0".
remote: [4/4] Building fresh packages ...
remote: warning Ignored scripts due to flag.
remote: Done in 5.90s.
remote: remote:
remote: ----->Caching build
remote: --yarn cache
remote: remote:
remote: ----->Build succeeded!
remote:! Unmet dependencies don't fail yarn install but may cause runtime issues
remote: https://github.com/npm/npm/issues/7494
remote: remote:
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-2.6.6
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:/tmp/build_09e402e7/bin/bundle: line 1: require: command not found
remote:/tmp/build_09e402e7/bin/bundle: line 3: m: command not foundremote:/tmp/build_09e402e7/bin/bundle: line 4: module_function: command not found
remote:/tmp/build_09e402e7/bin/bundle: line 6: def: command not found
remote:/tmp/build_09e402e7/bin/bundle: line 7: syntax error near unexpected token `$PROGRAM_NAME'
remote:/tmp/build_09e402e7/bin/bundle: line 7: `File.expand_path ($PROGRAM_NAME) == File.expand_path (__ FILE__)'
remote: Bundler Output:/tmp/build_09e402e7/bin/bundle: line 1: require: command not found
remote:/tmp/build_09e402e7/bin/bundle: line 3: m: command not found
remote:/tmp/build_09e402e7/bin/bundle: line 4: module_function: command not found
remote:/tmp/build_09e402e7/bin/bundle: line 6: def: command not found
remote:/tmp/build_09e402e7/bin/bundle: line 7: syntax error near unexpected token `$PROGRAM_NAME'
remote:/tmp/build_09e402e7/bin/bundle: line 7: `File.expand_path ($PROGRAM_NAME) == File.expand_path (__ FILE__)'
remote: remote:
remote:!
remote:! Failed to install gems via Bundler.
remote:!
remote:! Push rejected, failed to compile Ruby app.
remote: remote:
remote:! Push failed
remote: Verifying deploy ...
remote: remote:
remote:! Push rejected to music-sns-app.
remote: remote:
To https://git.heroku.com/music-sns-app.git
 ! [remote rejected] heroku_deploy_error->main (pre-receive hook declined)
error: failed to push some refs to'https://git.heroku.com/music-sns-app.git'

bin/bundle

require "rubygems"
m = Module.new do
  module_function
  def invoked_as_script?
    File.expand_path ($PROGRAM_NAME) == File.expand_path (__ FILE__)
  end
  def env_var_version
    ENV ["BUNDLER_VERSION"]
  end
  def cli_arg_version
    return unless invoked_as_script? #don't want to hijack other binstubs
    return unless "update" .start_with? (ARGV.first || "") # must be running `bundle update`
    bundler_version = nil
    update_index = nil
    ARGV.each_with_index do | a, i |
      if update_index&&update_index.succ == i&&a = ~ Gem :: Version :: ANCHORED_VERSION_PATTERN
        bundler_version = a
      end
      next unless a = ~/\ A--bundler (?: [=] (# {Gem :: Version :: VERSION_PATTERN}))? \ Z /
      bundler_version = Regexp.last_match (1)
      update_index = i
    end
    bundler_version
  end
  def gemfile
    gemfile = ENV ["BUNDLE_GEMFILE"]
    return gemfile if gemfile.present?
    File.expand_path ("../../ Gemfile", __FILE__)
  enddef lockfile
    lockfile =
      case File.basename (gemfile)
      when "gems.rb" then gemfile.sub (/\.rb$/, gemfile)
      else "# {gemfile} .lock"
      end
    File.expand_path (lockfile)
  end
  def lockfile_version
    return unless File.file? (Lockfile)
    lockfile_contents = File.read (lockfile)
    return unless lockfile_contents = ~/\ n \ nBUNDLED WITH \ n \ s {2,} (# {Gem :: Version :: VERSION_PATTERN}) \ n /
    Regexp.last_match (1)
  end
  def bundler_version
    @bundler_version || =
      env_var_version || cli_arg_version ||
        lockfile_version
  end
  def bundler_requirement
    return "# {Gem :: Requirement.default} .a" unless bundler_version
    bundler_gem_version = Gem :: Version.new (bundler_version)
    requirement = bundler_gem_version.approximate_recommendation
    return requirement unless Gem :: Version.new (Gem :: VERSION)<Gem :: Version.new ("2.7.0")
    requirement + = ".a" if bundler_gem_version.prerelease?
    requirement
  end
  def load_bundler!
    ENV ["BUNDLE_GEMFILE"] || = gemfile
    activate_bundler
  end
  def activate_bundler
    gem_error = activation_error_handling do
      gem "bundler", bundler_requirement
    end
    return if gem_error.nil?
    require_error = activation_error_handling do
      require "bundler/version"
    end
    return if require_error.nil?&&gem :: Requirement.new (bundler_requirement) .satisfied_by? (Gem :: Version.new (Bundler :: VERSION))
    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}'` "
    exit 42
  end
  def activation_error_handling
    yield
    nil
  rescue StandardError, LoadError =>e
    e
  end
end
m.load_bundler!
if m.invoked_as_script?
  load Gem.bin_path ("bundler", "bundle")
end