简体   繁体   English

我无法启动 Rails 服务器

[英]I can't start the rails server

I think it must be a problem related to the path.我想应该是路径的问题。 I made the step by step of this page https://meekgonkey.blogspot.com/2014/02/installing-ruby-rails-on-manjaro-linux.html我一步一步制作了这个页面https://meekgonkey.blogspot.com/2014/02/installing-ruby-rails-on-manjaro-linux.html

    /usr/lib/ruby/3.0.0/pathname.rb:20: warning: already initialized constant Pathname::TO_PATH
/home/vitaopb/.local/share/gem/ruby/3.0.0/gems/pathname-0.2.0/lib/pathname.rb:20: warning: previous definition of TO_PATH was here
/usr/lib/ruby/3.0.0/pathname.rb:22: warning: already initialized constant Pathname::SAME_PATHS
/home/vitaopb/.local/share/gem/ruby/3.0.0/gems/pathname-0.2.0/lib/pathname.rb:22: warning: previous definition of SAME_PATHS was here
/usr/lib/ruby/3.0.0/pathname.rb:34: warning: already initialized constant Pathname::SEPARATOR_LIST
/home/vitaopb/.local/share/gem/ruby/3.0.0/gems/pathname-0.2.0/lib/pathname.rb:34: warning: previous definition of SEPARATOR_LIST was here
/usr/lib/ruby/3.0.0/pathname.rb:35: warning: already initialized constant Pathname::SEPARATOR_PAT
/home/vitaopb/.local/share/gem/ruby/3.0.0/gems/pathname-0.2.0/lib/pathname.rb:35: warning: previous definition of SEPARATOR_PAT was here
/usr/lib/ruby/3.0.0/pathname.rb:41: warning: already initialized constant Pathname::ABSOLUTE_PATH
/home/vitaopb/.local/share/gem/ruby/3.0.0/gems/pathname-0.2.0/lib/pathname.rb:41: warning: previous definition of ABSOLUTE_PATH was here
/usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/path.rb:103:in `to_s': unexpected @path (TypeError)
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/path.rb:103:in `stability'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/path.rb:11:in `stable?'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/path.rb:41:in `entries_and_dirs'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/cache.rb:159:in `block (2 levels) in unshift_paths_locked'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/cache.rb:155:in `reverse_each'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/cache.rb:155:in `block in unshift_paths_locked'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/store.rb:47:in `block in transaction'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/store.rb:45:in `synchronize'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/store.rb:45:in `transaction'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/cache.rb:154:in `unshift_paths_locked'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/cache.rb:107:in `block in unshift_paths'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/cache.rb:107:in `synchronize'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/cache.rb:107:in `unshift_paths'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/change_observer.rb:21:in `unshift'
        from /home/vitaopb/.local/share/gem/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/application.rb:361:in `add_lib_to_load_path!'
        from /home/vitaopb/.local/share/gem/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/application.rb:95:in `inherited'
        from /home/vitaopb/Documentos/rails/app-Tes/config/application.rb:11:in `<module:AppTes>'
        from /home/vitaopb/Documentos/rails/app-Tes/config/application.rb:9:in `<main>'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from /home/vitaopb/.local/share/gem/ruby/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `block in require'
        from /home/vitaopb/.local/share/gem/ruby/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
        from /home/vitaopb/.local/share/gem/ruby/3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:332:in `require'
        from /home/vitaopb/.local/share/gem/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/commands/server/server_command.rb:138:in `block in perform'
        from <internal:kernel>:90:in `tap'
        from /home/vitaopb/.local/share/gem/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/commands/server/server_command.rb:135:in `perform'
        from /home/vitaopb/.local/share/gem/ruby/3.0.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
        from /home/vitaopb/.local/share/gem/ruby/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
        from /home/vitaopb/.local/share/gem/ruby/3.0.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
        from /home/vitaopb/.local/share/gem/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/command/base.rb:69:in `perform'
        from /home/vitaopb/.local/share/gem/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/command.rb:48:in `invoke'
        from /home/vitaopb/.local/share/gem/ruby/3.0.0/gems/railties-6.1.4.1/lib/rails/commands.rb:18:in `<main>'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from /usr/lib/ruby/gems/3.0.0/gems/bootsnap-1.9.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from /home/vitaopb/Documentos/rails/app-Tes/bin/rails:5:in `<top (required)>'
        from /usr/lib/ruby/gems/3.0.0/gems/spring-3.0.0/lib/spring/client/rails.rb:28:in `load'
        from /usr/lib/ruby/gems/3.0.0/gems/spring-3.0.0/lib/spring/client/rails.rb:28:in `call'
        from /usr/lib/ruby/gems/3.0.0/gems/spring-3.0.0/lib/spring/client/command.rb:7:in `call'
        from /usr/lib/ruby/gems/3.0.0/gems/spring-3.0.0/lib/spring/client.rb:30:in `run'
        from /usr/lib/ruby/gems/3.0.0/gems/spring-3.0.0/bin/spring:49:in `<top (required)>'
        from /usr/lib/ruby/gems/3.0.0/gems/spring-3.0.0/lib/spring/binstub.rb:11:in `load'
        from /usr/lib/ruby/gems/3.0.0/gems/spring-3.0.0/lib/spring/binstub.rb:11:in `<top (required)>'
        from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/usr/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from /home/vitaopb/Documentos/rails/app-Tes/bin/spring:10:in `block in <top (required)>'
        from <internal:kernel>:90:in `tap'
        from /home/vitaopb/Documentos/rails/app-Tes/bin/spring:7:in `<top (required)>'
        from bin/rails:2:in `load'
        from bin/rails:2:in `<main>'

I had a similar error while running rails new <ProjectName> .我在运行rails new <ProjectName>时遇到了类似的错误。 Managed to create the project using a workaround but later got the exact same error while trying to rails s .设法使用变通方法创建了项目,但后来在尝试rails s时遇到了完全相同的错误。

For some reason bundle exec rails s would throw a lengthy cryptic error and end with an abort and core dump.出于某种原因, bundle exec rails s会抛出一个冗长的神秘错误并以中止和核心转储结束。

Uninstalling all gems and reinstalling them for my rbenv version fixed it for me.卸载所有 gems 并为我的 rbenv 版本重新安装它们为我修复了它。

$ gem uninstall -aIx

$ gem install rails -v 6.1.4.1

$ rbenv rehash

(At this point rbenv threw another error saying /home/.../.rbenv-shim existed, then I ran..) (此时rbenv抛出另一个错误,说/home/.../.rbenv-shim存在,然后我跑了..)

$ rm /home/username/.rbenv/shims/.rbenv-shim
$ rbenv rehash

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM