gpt4 book ai didi

ruby-on-rails - Rails 4 错误,每个命令 "` load' : no implicit conversion of nil into String"(Mac OS X 10. 9)

转载 作者:数据小太阳 更新时间:2023-10-29 08:22:47 24 4
gpt4 key购买 nike

我刚刚在运行 Mac OS X 10.9 Mavericks 的新 Macbook 上安装了全新的 Ruby on Rails 开发堆栈。

这是我的堆栈:

  • Xcode 命令行工具
  • 自制
  • Rbenv
  • bundler
  • ruby 2.1.0
  • rails 4.1.1

我运行 rails new test_app 来生成第一个测试应用程序。此命令已成功完成,但自此之后,我在 CLI 中尝试的每个 Rails 命令都会返回此类错误消息:

$ test_app > bin/rails server

/Users/me/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `load': no implicit conversion of nil into String (TypeError)
from /Users/me/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `call'
from /Users/me/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
from /Users/me/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
from /Users/me/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
from /Users/me/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
from /Users/me/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /Users/me/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/me/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/me/Documents/[PERSONNEL]/dev/test_app/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'

尝试启动控制台时出现同样的错误:

$ test_app > bin/rails c

/Users/me/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `load': no implicit conversion of nil into String (TypeError)
from /Users/me/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `block in load'
from /Users/me/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/me/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `load'
from /Users/me/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/me/.rbenv/versions/2.1.0/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'

bin/rake 部分工作(我可以使用 bin/rake routes 但迁移不工作)。

我最后一次尝试安装 XCode,但没有解决问题。


更新:下面提到的命令bundle exec rake rails:update:bin解决了项目的问题,但需要在每个新问题上执行。问题似乎更深。

最佳答案

好的,我找到了解决方案。

我也清理了我的 mac。我得到了同样的错误。

rails_root/bin 文件夹不存在?

试试下面

bundle exec rake rails:update:bin

关于ruby-on-rails - Rails 4 错误,每个命令 "` load' : no implicit conversion of nil into String"(Mac OS X 10. 9),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24960417/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com