Solucionado (ver solução)
Solucionado
(ver solução)
18
respostas

Erro ao realizar o Deploy

-----> Building on the Heroku-20 stack

-----> Using buildpack: heroku/ruby

-----> Ruby app detected

-----> Installing bundler 2.2.11

-----> Removing BUNDLED WITH version in the Gemfile.lock -----> Compiling Ruby/Rails

WARNING:
   Improperly formatted binstubs detected in your project

   The following file(s) have appear to contain a problematic "shebang" line

     - bin/bundle

   For example bin/bundle has the shebang line:

   ```
   #!/usr/bin/env ruby2.7
   ```

   It should be:

   ```
   #!/usr/bin/env ruby
   ```

   A malformed shebang line may cause your program to crash.

   For more information about binstubs and "shebang" lines see:
     https://devcenter.heroku.com/articles/bad-ruby-binstub-shebang
   Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-2.7.0.tgz -s -o - | tar zxf - ' failed on attempt 1 of 3.
   Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-20/ruby-2.7.0.tgz -s -o - | tar zxf - ' failed on attempt 2 of 3.

! ! The Ruby version you are trying to install does not exist on this stack. ! ! You are trying to install ruby-2.7.0 on heroku-20. ! ! Ruby ruby-2.7.0 is present on the following stacks: ! ! - cedar-14 ! - heroku-16 ! - heroku-18 ! ! Heroku recommends you use the latest supported Ruby version listed here: ! https://devcenter.heroku.com/articles/ruby-support#supported-runtimes ! ! For more information on syntax for declaring a Ruby version see: ! https://devcenter.heroku.com/articles/ruby-versions ! ! Push rejected, failed to compile Ruby app. ! Push failed

18 respostas

Oi, Alan,

Tenta fazer o que o log tá dizendo. Ele disse que a versão Ruby 2.7.0 não é suportada no heroku-20 então você teria que usar algo como 2.7.2 ou mudar pra heroku-18. Ele falou um pouco acima disso uma correção que você pode tentar.

No arquivo bundle na pasta bin mude o começo do arquivo de #!/usr/bin/env ruby2.7 para #!/usr/bin/env ruby assim você não trava a versão.

Mas é bem provável só mudar o erro e ainda não conseguir por conta de outro arquivo, qualquer coisa avisa por aqui.

Fiz algumas mudanças só isso não vai de jeito nenhum, fique preso aqui, como posso mudar é direto em algum outro arquivo, já fiz no GENFILE e no arquivo oculto, o código no desenvolvimento está funcionando, mas o deploy no. Heroku gera tal erro:

Bundler Output: Your Ruby version is 2.7.0, but your Gemfile specified 2.7.1

-----> Building on the Heroku-20 stack

-----> Using buildpack: heroku/ruby

-----> Ruby app detected

-----> Installing bundler 2.2.11

-----> Removing BUNDLED WITH version in the Gemfile.lock -----> Compiling Ruby/Rails

WARNING:
   Improperly formatted binstubs detected in your project

   The following file(s) have appear to contain a problematic "shebang" line

     - bin/bundle

   For example bin/bundle has the shebang line:

   ```
   #!/usr/bin/env ruby2.7
   ```

   It should be:

   ```
   #!/usr/bin/env ruby
   ```

   A malformed shebang line may cause your program to crash.

   For more information about binstubs and "shebang" lines see:
     https://devcenter.heroku.com/articles/bad-ruby-binstub-shebang

-----> Using Ruby version: ruby-2.7.1 -----> Installing dependencies using bundler 2.2.11 Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4 Your Ruby version is 2.7.0, but your Gemfile specified 2.7.1 Bundler Output: Your Ruby version is 2.7.0, but your Gemfile specified 2.7.1 ! ! Failed to install gems via Bundler. ! Detected a mismatch between your Ruby version installed and ! Ruby version specified in Gemfile or Gemfile.lock. You can ! correct this by running: ! ! $ bundle update --ruby ! $ git add Gemfile.lock ! $ git commit -m "update ruby version" ! ! If this does not solve the issue please see this documentation: ! ! https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y ! ! Push rejected, failed to compile Ruby app. ! Push failed

Você alterou o arquivo bin/bundle? Porque o erro continua o mesmo.

No arquivo bundle na pasta bin mude o começo do arquivo de #!/usr/bin/env ruby2.7 para #!/usr/bin/env ruby assim você não trava a versão.

Olá o meu também está dando o mesmo erro e eu já fiz a alteração na pasta bin e mesmo assim não funciona.

remote:  !
remote:  !     The Ruby version you are trying to install does not exist on this stack.
remote:  !     
remote:  !     You are trying to install ruby-2.7.0 on heroku-20.
remote:  !     
remote:  !     Ruby ruby-2.7.0 is present on the following stacks:
remote:  !     
remote:  !     - cedar-14
remote:  !     - heroku-16
remote:  !     - heroku-18
remote:  !     
remote:  !     Heroku recommends you use the latest supported Ruby version listed here:
remote:  !     https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
remote:  !     
remote:  !     For more information on syntax for declaring a Ruby version see:
remote:  !     https://devcenter.heroku.com/articles/ruby-versions
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !    Push rejected to jhustore.
remote: 
To https://git.heroku.com/jhustore.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/jhustore.git'

O que devo fazer?

solução!

Oi, Henrique, tudo bem?

Eu tinha comentado sobre esse problema um pouco acima:

Ruby 2.7.0 não é suportada no heroku-20 então você teria que usar algo como 2.7.2

Você pode mudar a stack do Heroku pra versão 18 e tentar subir com essa versão, acho que o comando seria algo como:

heroku stack:set heroku-18 --app nome_da_sua_app_no_heroku

Veja se isso resolve :)

Acredito que não tenha dado certo pois deu erro após inserir o código que você indicou...

Enumerating objects: 7991, done.
Counting objects: 100% (7991/7991), done.
Delta compression using up to 8 threads
Compressing objects: 100% (6446/6446), done.
Writing objects: 100% (7991/7991), 26.50 MiB | 2.38 MiB/s, done.
Total 7991 (delta 1016), reused 7974 (delta 1008)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-18 stack
remote: -----> Determining which buildpack to use for this app
remote:  !     Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote:             Detected buildpacks: Ruby,Node.js
remote:             See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.2.11
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.7.0
remote: -----> Installing dependencies using bundler 2.2.11
remote:        Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
remote:        You are trying to install in deployment mode after changing
remote:        your Gemfile. Run `bundle install` elsewhere and add the
remote:        updated Gemfile.lock to version control.
remote:        
remote:        If this is a development machine, remove the /tmp/build_2f169cbc/Gemfile freeze 
remote:        by running ``.
remote:        
remote:        The dependencies in your gemfile changed
remote:        
remote:        You have added to the Gemfile:
remote:        * pg
remote:        Bundler Output: You are trying to install in deployment mode after changing
remote:        your Gemfile. Run `bundle install` elsewhere and add the
remote:        updated Gemfile.lock to version control.
remote:        
remote:        If this is a development machine, remove the /tmp/build_2f169cbc/Gemfile freeze 
remote:        by running ``.
remote:        
remote:        The dependencies in your gemfile changed
remote:        
remote:        You have added to the Gemfile:
remote:        * pg
remote: 
remote:  !
remote:  !     Failed to install gems via Bundler.
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: e2e91737e74a6f6875603814122cb5ffb5e420da
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version e2e91737e74a6f6875603814122cb5ffb5e420da
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 jhustore.
remote: 
To https://git.heroku.com/jhustore.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/jhustore.git'

Oi, Henrique, aí seu problema está ficando muito especifico. Recomendo abrir um tópico no forum pra solucionarmos o seu.

Mas pelo log você mudou o seu Gemfile pra incluir a gem 'pg' e não rodou o bundle install para atualizar o Gemfile.lock

Ok vou abrir outro tópico, pois tentei aqui e não foi. Obrigado

Abre lá e já coloca o novo log que já dou uma olhada :)

Beleza, já criei, obrigado :]

Tá complicado,

-----> Building on the Heroku-20 stack

-----> Using buildpack: heroku/ruby

-----> Ruby app detected

-----> Installing bundler 2.2.11

-----> Removing BUNDLED WITH version in the Gemfile.lock

-----> Compiling Ruby/Rails

-----> Using Ruby version: ruby-2.7.1 -----> Installing dependencies using bundler 2.2.11 Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4 Fetching gem metadata from https://rubygems.org/............ Your bundle is locked to mimemagic (0.3.6), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of mimemagic (0.3.6) has removed it. You'll need to update your bundle to a version other than mimemagic (0.3.6) that hasn't been removed in order to install. Bundler Output: Fetching gem metadata from https://rubygems.org/............ Your bundle is locked to mimemagic (0.3.6), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of mimemagic (0.3.6) has removed it. You'll need to update your bundle to a version other than mimemagic (0.3.6) that hasn't been removed in order to install. ! ! Failed to install gems via Bundler. ! ! Push rejected, failed to compile Ruby app. ! Push failed

Oi, Alan, esse foi um erro descoberto ontem pelo time do Rails a gem mimemagic é uma dependência interna mas que mudar a licença para GPL, o build de várias empresas está quebrando. Se seu projeto for só pra estudo você pode fazer um bundle update mimemagic e tentar novamente

Estou só aguardando o Heroku normalizar, pois está fora do ar por causa de algum problema de API. Assim testar darei um retorno.

Estou quase desistindo e criando tudo do zero, meu Deploy começa bem e livre dos erros anteriores, mas agora não saí disso:

O erro começa "Could not detect rake tasks"

Não sei se foi a mudança de versão da 2.7.0 para 2.7.1, se tiver como ajudar ou dar uma luz.


remote: Bundle complete! 23 Gemfile dependencies, 66 gems now installed. remote: Gems in the groups development and test were not installed. remote: Bundled gems are installed into ./vendor/bundle remote: Post-install message from twitter-bootstrap-rails: remote: Important: You may need to add a javascript runtime to your Gemfile in order for bootstrap's LESS files to compile to CSS. remote:remote: ** remote:remote: ExecJS supports these runtimes: remote:remote: therubyracer - Google V8 embedded within Ruby remote:remote: therubyrhino - Mozilla Rhino embedded within JRuby remote:remote: Node.js remote:remote: Apple JavaScriptCore - Included with Mac OS X remote:remote: Microsoft Windows Script Host (JScript) remote:remote: ** remote: Bundle completed (272.52s) 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: remote: ! remote: ! Could not detect rake tasks remote: ! ensure you can run $ bundle exec rake -P against your app remote: ! and using the production group of your Gemfile. remote: ! /tmp/build_124e8f72/vendor/ruby-2.7.1/lib/ruby/2.7.0/rubygems/dependency.rb:311:in to_specs': Could not find 'spring' (= 2.1.1) among 115 total gem(s) (Gem::MissingSpecError) remote: ! Checked in 'GEM_PATH=/tmp/build_124e8f72/vendor/bundle/ruby/2.7.0', executegem envfor more information remote: ! from /tmp/build_124e8f72/vendor/ruby-2.7.1/lib/ruby/2.7.0/rubygems/dependency.rb:323:into_spec' remote: ! from /tmp/build_124e8f72/vendor/ruby-2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_gem.rb:62:in gem' remote: ! from /tmp/build_124e8f72/bin/spring:14:in<top (required)>' remote: ! from /tmp/build_124e8f72/bin/rake:7:in load' remote: ! from /tmp/build_124e8f72/bin/rake:7:in

' remote: ! remote: /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/helpers/rake_runner.rb:106:in load_rake_tasks!': Could not detect rake tasks (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError) remote: ensure you can run$ bundle exec rake -Pagainst your app remote: and using the production group of your Gemfile. remote: /tmp/build_124e8f72/vendor/ruby-2.7.1/lib/ruby/2.7.0/rubygems/dependency.rb:311:into_specs': Could not find 'spring' (= 2.1.1) among 115 total gem(s) (Gem::MissingSpecError) remote: Checked in 'GEM_PATH=/tmp/build_124e8f72/vendor/bundle/ruby/2.7.0', execute gem env for more information

O único erro que tenho até agora é:

remote: -----> Detecting rake tasks remote: remote: ! remote: ! Could not detect rake tasks remote: ! ensure you can run $ bundle exec rake -P against your app remote: ! and using the production group of your Gemfile. remote: ! /tmp/build_37954d75/bin/rake:4:in require': cannot load such file -- rake (LoadError) remote: ! from /tmp/build_37954d75/bin/rake:4:in

' remote: !

Isso é na sua máquina ou no heroku?

ps.: lembrando que se for usar stack heroku-20 você vai ter que usar Ruby 2.7.2 ou acima, pra usar abaixo disso só usando heroku-18

Valeu Henrique, mudei para a verão do ruby 2.7.2, ainda tive alguns erros de dependências, mas consegui corrigir.

Publicado em: https://lojatreinalinux.herokuapp.com

aeeeeeeeeee bom demais!

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software