簡體   English   中英

我無法啟動 Rails 服務器

[英]I can't start the rails server

我想應該是路徑的問題。 我一步一步制作了這個頁面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>'

我在運行rails new <ProjectName>時遇到了類似的錯誤。 設法使用變通方法創建了項目,但后來在嘗試rails s時遇到了完全相同的錯誤。

出於某種原因, bundle exec rails s會拋出一個冗長的神秘錯誤並以中止和核心轉儲結束。

卸載所有 gems 並為我的 rbenv 版本重新安裝它們為我修復了它。

$ gem uninstall -aIx

$ gem install rails -v 6.1.4.1

$ rbenv rehash

(此時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