Erro durante execução do comando: bundle exec rails db:migrate [RESOLVIDO]

1. Erro durante execução do comando: bundle exec rails db:migrate [RESOLVIDO]

Lucas jose Pereia de Araujo
LucasJPA

(usa Debian)

Enviado em 07/02/2019 - 01:58h

Boa noite

Estou tentando aprender a usar ruby e em um curso da internet o professor instruiu os comandos da instalação, fiz tudo certo, instalei o ruby, o rails, o bundle, o postgresql, mas ao executar o comando: bundle exec rails db:migrate, depois de ter criado uma nova aplicação aparece o erro, que pelo que entendi está relacionado com o banco de dados:
rails aborted!
LoadError: Error loading the 'sqlite3' Active Record adapter. Missing a gem it depends on? can't activate sqlite3 (~> 1.3.6), already activated sqlite3-1.4.0. Make sure all dependencies are added to Gemfile.
/home/araujo/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/rubygems_integration.rb:408:in `block (2 levels) in replace_gem'
/var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:12:in `<main>'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
/var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/connection_specification.rb:191:in `spec'
/var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:952:in `establish_connection'
/var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_handling.rb:60:in `establish_connection'
/var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/railtie.rb:136:in `block (2 levels) in <class:Railtie>'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:51:in `each'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
/var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/base.rb:328:in `<module:ActiveRecord>'
/var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/base.rb:27:in `<main>'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
/var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <main>'
/var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/command.rb:48:in `invoke'
/var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/commands.rb:18:in `<main>'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
/home/araujo/Documentos/projetos_rails/app/bin/rails:9:in `<top (required)>'
/var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
/var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
/var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
/var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
/var/lib/gems/2.5.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
/var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/home/araujo/Documentos/projetos_rails/app/bin/spring:15:in `require'
/home/araujo/Documentos/projetos_rails/app/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

Caused by:
Gem::LoadError: can't activate sqlite3 (~> 1.3.6), already activated sqlite3-1.4.0. Make sure all dependencies are added to Gemfile.
/home/araujo/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/bundler-2.0.1/lib/bundler/rubygems_integration.rb:408:in `block (2 levels) in replace_gem'
/var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:12:in `<main>'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
/var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/connection_specification.rb:191:in `spec'
/var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:952:in `establish_connection'
/var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_handling.rb:60:in `establish_connection'
/var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/railtie.rb:136:in `block (2 levels) in <class:Railtie>'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:51:in `each'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
/var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/base.rb:328:in `<module:ActiveRecord>'
/var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/base.rb:27:in `<main>'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
/var/lib/gems/2.5.0/gems/activerecord-5.2.2/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <main>'
/var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/command.rb:48:in `invoke'
/var/lib/gems/2.5.0/gems/railties-5.2.2/lib/rails/commands.rb:18:in `<main>'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
/var/lib/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
/var/lib/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
/home/araujo/Documentos/projetos_rails/app/bin/rails:9:in `<top (required)>'
/var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
/var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
/var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
/var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
/var/lib/gems/2.5.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
/var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/home/araujo/Documentos/projetos_rails/app/bin/spring:15:in `require'
/home/araujo/Documentos/projetos_rails/app/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)


O erro é bem grande e não sei o que causa isso nem como resolver, já agradeço a ajuda de todos.


  


2. Re: Erro durante execução do comando: bundle exec rails db:migrate [RESOLVIDO]

André Lima
andreszlima

(usa Ubuntu)

Enviado em 08/02/2019 - 22:24h

Vai no arquivo Gemfile.lock, pesquisa por sqlite3. Lá vai estar escrito:

sqlite3 (1.4.0)

Muda a versão pra 1.3.13, que é a última antes do 1.4. Vai ficar:

sqlite3 (1.3.13)

Muda tbm no Gemfile (sem extensão). Onde tiver gem 'sqlite3', muda pra:

# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~> 1.3', '>= 1.3.13'

Criei uma conta nesse site só pra te responder isso hahaahh


3. Re: Erro durante execução do comando: bundle exec rails db:migrate [RESOLVIDO]

Lucas jose Pereia de Araujo
LucasJPA

(usa Debian)

Enviado em 09/02/2019 - 00:42h

Cara eu fiz do jeito que você mandou mas ao executar o comando:
gem 'sqlite3', '~> 1.3', '>= 1.3.13'

tem esse retorno:
ERROR: While executing gem ... (Gem::CommandLineError)
Unknown command sqlite3,


4. Re: Erro durante execução do comando: bundle exec rails db:migrate [RESOLVIDO]

Filipe Mosca
filipemosca

(usa Debian)

Enviado em 09/02/2019 - 00:52h

Não sei se tem relação mas toda vez vou instalar o gems e o ruby nos meus sistemas acontece isso de não reconhecer os comandos. Ai é só especificar o diretório /bins deles no $PATH.

Não sei se minha informação vai somar em alguma coisa mas tamo ai


5. Re: Erro durante execução do comando: bundle exec rails db:migrate [RESOLVIDO]

Lucas jose Pereia de Araujo
LucasJPA

(usa Debian)

Enviado em 09/02/2019 - 00:58h

cara qualquer coisa soma quando se está desesperado. Já mudei de SO, já tentei de tudo, já to até com raiva.



6. Re: Erro durante execução do comando: bundle exec rails db:migrate [RESOLVIDO]

André Lima
andreszlima

(usa Ubuntu)

Enviado em 09/02/2019 - 23:25h

Mudou tbm no arquivo "GEMFILE.lock" ?


7. Re: Erro durante execução do comando: bundle exec rails db:migrate [RESOLVIDO]

Lucas jose Pereia de Araujo
LucasJPA

(usa Debian)

Enviado em 09/02/2019 - 23:58h

Sim mudei mas agora ele manda um erro com a verão do sqlite3, quando tentei instalar a versão 1.3.6 pelo comando gem install sqlite -v '1.3.6', deu esse erro

Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.

current directory: /home/araujo/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sqlite3-1.3.6/ext/sqlite3
/home/araujo/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20190209-7127-ghb35n.rb extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... yes
checking for sqlite3_enable_load_extension()... yes
checking for sqlite3_load_extension()... yes
checking for sqlite3_open_v2()... yes
checking for sqlite3_prepare_v2()... yes
checking for sqlite3_int64 in sqlite3.h... yes
checking for sqlite3_uint64 in sqlite3.h... yes
creating Makefile

current directory: /home/araujo/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sqlite3-1.3.6/ext/sqlite3
make "DESTDIR=" clean

current directory: /home/araujo/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sqlite3-1.3.6/ext/sqlite3
make "DESTDIR="
compiling backup.c
compiling database.c
compiling exception.c
compiling sqlite3.c
compiling statement.c
In file included from statement.c:1:0:
statement.c: In function ‘bind_param’:
./sqlite3_ruby.h:16:24: warning: implicit declaration of function ‘RBIGNUM’; did you mean ‘T_BIGNUM’? [-Wimplicit-function-declaration]
#define RBIGNUM_LEN(x) RBIGNUM(x)->len
^
statement.c:262:11: note: in expansion of macro ‘RBIGNUM_LEN’
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^~~~~~~~~~~
./sqlite3_ruby.h:16:34: error: invalid type argument of ‘->’ (have ‘int’)
#define RBIGNUM_LEN(x) RBIGNUM(x)->len
^
statement.c:262:11: note: in expansion of macro ‘RBIGNUM_LEN’
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^~~~~~~~~~~
statement.c:262:32: error: ‘SIZEOF_BDIGITS’ undeclared (first use in this function); did you mean ‘SIZEOF_INT’?
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^~~~~~~~~~~~~~
SIZEOF_INT
statement.c:262:32: note: each undeclared identifier is reported only once for each function it appears in
statement.c: In function ‘reset_bang’:
statement.c:294:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
int status;
^~~~~~
statement.c: In function ‘clear_bindings’:
statement.c:314:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
int status;
^~~~~~
statement.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
Makefile:241: recipe for target 'statement.o' failed
make: *** [statement.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/araujo/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sqlite3-1.3.6 for inspection.
Results logged to /home/araujo/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-linux/2.5.0-static/sqlite3-1.3.6/gem_make.out



8. Re: Erro durante execução do comando: bundle exec rails db:migrate [RESOLVIDO]

André Lima
andreszlima

(usa Ubuntu)

Enviado em 12/02/2019 - 15:48h

Acho que já tive esse problema de BIGNUM... Mas n sei o q rolou pra resolver. Não sei se foi mudando a versão do Ruby ou foi mudando o instalador de RBENV pra RVM... Se eu fosse vc tentaria isso. Mais um chute mesmo






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts