"ERROR TypeError: can't dup NilClass" in a Rails 3 app? Any ideas - I'm just hitting the home page and get this...it was working just before...
Rails 3应用程序中的“ERROR TypeError:无法复制NilClass”?任何想法 - 我只是点击主页并得到这个...它刚刚开始......
Gregs-MacBook-Pro:source_rails greg$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
Gregs-MacBook-Pro:source_rails greg$ rails -v
Rails 3.2.1
Gregs-MacBook-Pro:source_rails greg$ rails new test3
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/rails.png
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/mailers
create app/models
create app/views/layouts/application.html.erb
create app/mailers/.gitkeep
create app/models/.gitkeep
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create doc
create doc/README_FOR_APP
create lib
create lib/tasks
create lib/tasks/.gitkeep
create lib/assets
create lib/assets/.gitkeep
create log
create log/.gitkeep
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/index.html
create public/robots.txt
create script
create script/rails
create test/fixtures
create test/fixtures/.gitkeep
create test/functional
create test/functional/.gitkeep
create test/integration
create test/integration/.gitkeep
create test/unit
create test/unit/.gitkeep
create test/performance/browsing_test.rb
create test/test_helper.rb
create tmp/cache
create tmp/cache/assets
create vendor/assets/javascripts
create vendor/assets/javascripts/.gitkeep
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.gitkeep
create vendor/plugins
create vendor/plugins/.gitkeep
run bundle install
Enter your password to install the bundled RubyGems to your system:
Fetching source index for https://rubygems.org/
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.0.4)
Using activesupport (3.2.1)
Using builder (3.0.0)
Using activemodel (3.2.1)
Using erubis (2.7.0)
Using journey (1.0.1)
Using rack (1.4.1)
Using rack-cache (1.1)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.2)
Using actionpack (3.2.1)
Using mime-types (1.17.2)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.1)
Using actionmailer (3.2.1)
Using arel (3.0.0)
Using tzinfo (0.3.31)
Using activerecord (3.2.1)
Using activeresource (3.2.1)
Using bundler (1.0.22)
Using coffee-script-source (1.2.0)
Using execjs (1.3.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.6.5)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.1)
Using coffee-rails (3.2.2)
Using jquery-rails (2.0.0)
Using rails (3.2.1)
Using sass (3.1.15)
Using sass-rails (3.2.4)
Using sqlite3 (1.3.5)
Using uglifier (1.2.3)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Gregs-MacBook-Pro:source_rails greg$
Gregs-MacBook-Pro:source_rails greg$ cd test3
Gregs-MacBook-Pro:test3 greg$
Gregs-MacBook-Pro:test3 greg$ rails console
Loading development environment (Rails 3.2.1)
>> exit
Gregs-MacBook-Pro:test3 greg$ rails server
=> Booting WEBrick
=> Rails 3.2.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-02-13 09:19:59] INFO WEBrick 1.3.1
[2012-02-13 09:19:59] INFO ruby 1.8.7 (2010-01-10) [universal-darwin11.0]
[2012-02-13 09:19:59] INFO WEBrick::HTTPServer#start: pid=8435 port=3000
[2012-02-13 09:20:27] ERROR TypeError: can't dup NilClass
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httprequest.rb:204:in `dup'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httprequest.rb:204:in `meta_vars'
/Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler/webrick.rb:34:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler/webrick.rb:13:in `run'
/Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/server.rb:265:in `start'
/Library/Ruby/Gems/1.8/gems/railties-3.2.1/lib/rails/commands/server.rb:70:in `start'
/Library/Ruby/Gems/1.8/gems/railties-3.2.1/lib/rails/commands.rb:55
/Library/Ruby/Gems/1.8/gems/railties-3.2.1/lib/rails/commands.rb:50:in `tap'
/Library/Ruby/Gems/1.8/gems/railties-3.2.1/lib/rails/commands.rb:50
script/rails:6:in `require'
script/rails:6
UPDATE:
更新:
oh dear,
噢亲爱的,
Just when to latest ruby 1.9.3 using rvm, but I'm still getting same error - basically can't use rails at all at the moment:
刚刚使用rvm时最新的ruby 1.9.3,但我仍然得到同样的错误 - 目前基本上根本不能使用rails:
Gregs-MacBook-Pro:test_rvm193_1 greg$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.3.0]
Gregs-MacBook-Pro:test_rvm193_1 greg$ which ruby
/Users/greg/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
Gregs-MacBook-Pro:test_rvm193_1 greg$ rails -v
Rails 3.2.1
Gregs-MacBook-Pro:test_rvm193_1 greg$
Gregs-MacBook-Pro:test_rvm193_1 greg$ rails server
=> Booting WEBrick
=> Rails 3.2.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-02-13 11:30:11] INFO WEBrick 1.3.1
[2012-02-13 11:30:11] INFO ruby 1.9.3 (2011-10-30) [x86_64-darwin11.3.0]
[2012-02-13 11:30:11] INFO WEBrick::HTTPServer#start: pid=36488 port=3000
[2012-02-13 11:30:32] ERROR TypeError: can't dup NilClass
/Users/greg/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httprequest.rb:273:in `dup'
/Users/greg/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httprequest.rb:273:in `meta_vars'
/Users/greg/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/handler/webrick.rb:34:in `service'
/Users/greg/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/Users/greg/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/Users/greg/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
^C[2012-02-13 11:31:04] INFO going to shutdown ...
Any ideas?
有任何想法吗?
1 个解决方案
#1
1
arrr - I noted I had "https" not "http" in the url I was calling. That is I was using "localhost:3000";. Should this have had such an effect on rails?
arrr - 我注意到我在呼叫的网址中有“https”而不是“http”。那是我用的是“localhost:3000”;这应该对铁轨有这样的影响吗?
#1
1
arrr - I noted I had "https" not "http" in the url I was calling. That is I was using "localhost:3000";. Should this have had such an effect on rails?
arrr - 我注意到我在呼叫的网址中有“https”而不是“http”。那是我用的是“localhost:3000”;这应该对铁轨有这样的影响吗?