0
{9:08}~/dev/rails ➭ which ruby
/Users/jay/.rubies/ruby-2.7.1/bin/ruby
{9:08}~/dev/rails ➭ which rails
/Users/jay/.gem/ruby/2.7.1/bin/rails
{9:08}~/dev/rails ➭ rails -v
Rails 6.0.3.2
{9:08}~/dev/rails ➭ rails new one
      create  
      create  README.md
      create  Rakefile

*********************************************************************
********** lots of instal messages, no errors reported **************
*********************************************************************

✨  Done in 4.74s.
Webpacker successfully installed  
{9:09}~/dev/rails ➭ cd one
{9:09}~/dev/rails/one:master ✗ ➭ ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
{9:09}~/dev/rails/one:master ✗ ➭ which ruby
/Users/jay/.rubies/ruby-2.7.1/bin/ruby
{9:09}~/dev/rails/one:master ✗ ➭ which bundler
/Users/jay/.rubies/ruby-2.7.1/bin/bundler
{9:10}~/dev/rails/one:master ✗ ➭ bundle exec rails s
=> Booting Puma
=> Rails 6.0.3.2 application starting in development 
=> Run `rails server --help` for more startup options
Exiting
Traceback (most recent call last):
    80: from bin/rails:3:in `<main>'
    79: from bin/rails:3:in `load'
    78: from /Users/jay/Dev/rails/one/bin/spring:15:in `<top (required)>'
    77: from /Users/jay/Dev/rails/one/bin/spring:15:in `require'
    76: from /Users/jay/.gem/ruby/2.7.1/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
    75: from /Users/jay/.gem/ruby/2.7.1/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
    74: from /Users/jay/.gem/ruby/2.7.1/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
    73: from /Users/jay/.gem/ruby/2.7.1/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
    72: from /Users/jay/.gem/ruby/2.7.1/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
    71: from /Users/jay/.gem/ruby/2.7.1/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
    70: from /Users/jay/.gem/ruby/2.7.1/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
    69: from /Users/jay/Dev/rails/one/bin/rails:9:in `<top (required)>'
    68: from /Users/jay/.gem/ruby/2.7.1/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `require'
    67: from /Users/jay/.gem/ruby/2.7.1/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:291:in `load_dependency'

  *********************************************************************
  ********** more stack messages **************************************
  *********************************************************************

     2: from /Users/jay/.gem/ruby/2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
     1: from /Users/jay/.gem/ruby/2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Users/jay/.gem/ruby/2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require': incompatible library version - /Users/jay/.gem/ruby/2.7.1/gems/nio4r-2.5.2/lib/nio4r_ext.bundle (LoadError)
{9:19}~/dev/rails/one:master ✗ ➭ bundle exec spring binstub --all
* bin/rake: Spring already present
* bin/rails: Spring already present
{9:21}~/dev/rails/one:master ✗ ➭ bundler -v
Bundler version 2.1.4
{9:21}~/dev/rails/one:master ✗ ➭ bundle exec spring -v
Spring version 2.1.0

我试图查找此问题的其他事件并发现了类似的事情(例如Spring 和中间件冲突?),但没有一个能解决我的问题。我很确定这是一个环境问题,但无法弄清楚。我原以为全新安装的 ruby​​、rails 和新创建的 rails 应用程序可以正常工作,但似乎不行。任何建议都非常感谢。我应该补充一点,如果我在 ruby​​ v 2.6.6 上做同样的事情,它工作正常。

谢谢

4

1 回答 1

1

我的设置与您非常相似(ruby 2.7.1、MacOS 10.15.5、Bundler 2.1.4 等),我遇到了类似的问题。在一个流行的 Rails 教程中看到了这个声明(见图)。很多人对 spring 有问题,所以尝试创建一个没有 spring 的新 rails 应用程序并听 gems(在终端中写入:)$ rails new blog --skip-spring --skip-listen。希望这可以帮助!

截屏

于 2020-07-06T22:24:07.480 回答