Rails 最新版本 Rails 7 生成项目报错

huaiguoguo · 2022年10月26日 · 最后由 huaiguoguo 回复于 2022年11月25日 · 654 次阅读
F:\RubymineProjects>rails new blog
      ......
      ......
      create  test/integration/.keep
      create  test/channels/application_cable/connection_test.rb
      create  test/test_helper.rb
      create  test/system
      create  test/system/.keep
      create  test/application_system_test_case.rb
      create  storage
      create  storage/.keep
      create  tmp/storage
      create  tmp/storage/.keep
      remove  config/initializers/cors.rb
      remove  config/initializers/new_framework_defaults_7_0.rb
         run  bundle install
         run  bundle binstubs bundler
       rails  importmap:install
F:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/app_loader.rb:53:in `exec': No such file or directory - "F:/Program Files/Ruby31-x64/bin/ruby.exe" (Errno::ENOENT)
        from F:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/app_loader.rb:53:in `block in exec_app'
        from F:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/app_loader.rb:48:in `loop'
        from F:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/app_loader.rb:48:in `exec_app'
        from F:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/cli.rb:7:in `<top (required)>'
        from <internal:F:/Program Files/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'        from <internal:F:/Program Files/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'        from F:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/exe/rails:10:in `<top (required)>'
        from F:/Program Files/Ruby31-x64/bin/rails:32:in `load'
        from F:/Program Files/Ruby31-x64/bin/rails:32:in `<main>'
       rails  turbo:install stimulus:install
F:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/app_loader.rb:53:in `exec': No such file or directory - "F:/Program Files/Ruby31-x64/bin/ruby.exe" (Errno::ENOENT)
        from F:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/app_loader.rb:53:in `block in exec_app'
        from F:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/app_loader.rb:48:in `loop'
        from F:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/app_loader.rb:48:in `exec_app'
        from F:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/cli.rb:7:in `<top (required)>'
        from <internal:F:/Program Files/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'        from <internal:F:/Program Files/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'        from F:/Program Files/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.4/exe/rails:10:in `<top (required)>'
        from F:/Program Files/Ruby31-x64/bin/rails:32:in `load'
        from F:/Program Files/Ruby31-x64/bin/rails:32:in `<main>'

F:\RubymineProjects>

最好不用 windows 环境,用 mac 或 linux 比较方便。

Program Files 有空格识别不了,不要用 windows 写 rails

上 WSL、docker 或者虚拟机

不要用 Windows,要用 WSL2

楼上说的都没错,不过你简单试试也许也行,装 C 盘,根目录,ruby31 文件夹。

好的,感谢!

需要 登录 后方可回复, 如果你还没有账号请 注册新账号