我实际上并不是一个ruby开发人员,我只是试图从一个项目中设置开发环境,而且我很难按顺序获取宝石,所以我可以加载服务器。我主要做的是前端工作。无论如何,我的错误是:
There was an error while trying to load the gem 'ahoy_matey'.
Gem Load Error is: undefined method `hours' for 4:Fixnum
我过去两天一直在搜索谷歌,并且无法通过" ahoy_matey"来遇到遇到此问题的任何人。宝石。尝试启动服务器或迁移迁移时出现此错误。
Ruby 1.9.3
Rails 3.2.13
mysql2 0.3.17
感谢任何帮助。
完整追踪:
Bundler::GemRequireError: There was an error while trying to load the gem 'ahoy_matey'. Gem Load Error is: undefined method `hours' for 4:Fixnum Backtrace for gem load error is: /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/ahoy_matey-1.1.0/lib/ahoy.rb:43:in `' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/ahoy_matey-1.1.0/lib/ahoy.rb:39:in `' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/ahoy_matey-1.1.0/lib/ahoy_matey.rb:1:in `require' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/ahoy_matey-1.1.0/lib/ahoy_matey.rb:1:in `' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:86:in `require' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:86:in `block (2 levels) in require' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:81:in `each' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:81:in `block in require' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:70:in `each' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:70:in `require' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler.rb:102:in `require' /home/sirtastic/projects/dataraptor/config/application.rb:7:in `' /home/sirtastic/projects/dataraptor/Rakefile:5:in `require' /home/sirtastic/projects/dataraptor/Rakefile:5:in `' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load_rakefile' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/application.rb:689:in `raw_load_rakefile' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/application.rb:94:in `block in load_rakefile' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/application.rb:93:in `load_rakefile' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/application.rb:77:in `block in run' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/lib/rake/application.rb:75:in `run' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/rake-11.1.2/bin/rake:33:in `' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/bin/rake:23:in `load' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/bin/rake:23:in `' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/bin/ruby_executable_hooks:15:in `eval' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/bin/ruby_executable_hooks:15:in `' Bundler Error Backtrace: /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:90:in `rescue in block (2 levels) in require' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:85:in `block (2 levels) in require' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:81:in `each' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:81:in `block in require' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:70:in `each' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler/runtime.rb:70:in `require' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/gems/bundler-1.12.1/lib/bundler.rb:102:in `require' /home/sirtastic/projects/dataraptor/config/application.rb:7:in `' /home/sirtastic/projects/dataraptor/Rakefile:5:in `require' /home/sirtastic/projects/dataraptor/Rakefile:5:in `' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/bin/ruby_executable_hooks:15:in `eval' /home/sirtastic/.rvm/gems/ruby-1.9.3-p551@dr/bin/ruby_executable_hooks:15:in `' (See full trace by running task with --trace)
source 'http://rubygems.org' gem 'rails', '3.2.13' gem 'mysql2'#, '~> 0.3.11' gem 'sass-rails', '~> 3.2.3' # Because SCSS is compiled for embedded quoters # Gems used only for assets and not required # in production environments by default. group :assets do gem 'coffee-rails', '~> 3.2.1' # See https://github.com/sstephenson/execjs#readme for more supported runtimes gem 'therubyracer', :platforms => :ruby gem 'execjs', :platforms => :ruby gem 'uglifier', '>= 1.0.3' end gem 'jquery-rails', '~> 3.0.4' gem 'jquery-ui-rails', '~> 4.0.5' gem 'jquery_datepicker' group :production do gem 'pry', require:false end group :development, :test do gem 'capybara', :require => false gem 'database_cleaner', :require => false # for use with capybara tests gem 'factory_girl', '~> 4.1' # for generating test models gem 'factory_girl_rails', require:false gem 'forgery' # for generating test data gem 'pry' gem 'pry_debug' gem 'pry-nav' gem 'spork-rails', platform: [:mswin, :mingw] # Fast rpsec testing on Windows #### DON'T JUST ADD GEMS TO THE END OF THIS LIST! ALPHABETIZE! ### end group :development do gem 'thin' # Sane development server gem 'bullet' # for identifying areas to speed up database queries gem 'meta_request' # for chrome rails-panel gem 'rack-mini-profiler', require:false #### DON'T JUST ADD GEMS TO THE END OF THIS LIST! ALPHABETIZE! ### end group :test do gem 'launchy', :require => false gem 'rspec-rails' gem "selenium-webdriver", "~> 2.40.0" # for AJAX testing gem 'shoulda', :require => false gem 'simplecov', :require => false # Test coverage gem 'timecop' gem 'vcr', '~> 2.9.3'#'~> 2.5.0' gem "webmock", '~> 1.10.2' #### DON'T JUST ADD GEMS TO THE END OF THIS LIST! ALPHABETIZE! ### end group :dev, :release, :development do gem 'better_errors' gem 'binding_of_caller' # supports better errors by providing IDE in browser when error occurs end gem 'activeuuid', '>= 0.5.0' gem 'ahoy_matey', '1.1.0' #needs this exact version in order to output UUIDs consistently. the next version after does not. gem 'american_date' # by default, dates are parsed/formatted with American style gem 'angularjs-rails', '~> 1.0.7' gem 'attr_encrypted', '~> 1.2' # encrypt activerecord attributes in db gem 'authlogic', '~> 3.2' # user login gem 'aws-sdk' gem 'capistrano', require: false# deployment of application gem 'capistrano-ext', require: false gem 'carrierwave' # file upload solution gem 'daemons' # used for running delayed_job jobs gem 'encryptor', '~> 1.1' # handle encryption of ActiveRecord fields gem 'exception_notification', '~> 4.0.0' gem 'faraday' # REST client for interfacing with external APIs gem 'faraday_middleware' gem 'fog', '~> 1.22' # for Amazon Web Services cloud storage gem 'formatador', '~> 0.2' # This shouldn't need to be here. It is/was a dependency for fog-core, but it wasn't getting bundled (for some reason), so raking assets:precompile consistently failed. 2014-09-17. gem 'haml', '~> 4.0.3' gem 'holidays', '~> 2.1.0' gem 'httpi', '~> 2.2.7' gem 'json', '~> 1.8.1' # Specified so as to 'safely' conduct an update for the sake of stripe gem (2014-05-21) gem 'liquid', '~> 2.5.0' # rendering templates, such as Marketing::Email::Template gem 'mini_magick' # photo resizing gem 'momentjs-rails' gem 'multi_xml' gem 'paperclip', '~> 3.5.0' # handle file attachments to activerecord gem "paypal-recurring" gem 'nested_form' gem 'rails3-jquery-autocomplete'# supports autocomplete fields gem 'redis' # for publishing gem 'remotipart', '~> 1.0' # enables multipart form submissions over ajax gem 'ruby-saml', '~> 1.0.0' gem 'rvm-capistrano', require: false # for deploying to servers where multiple rubies are available gem 'safe_attributes' # takes care of attribute name collisions w/ ActiveRecord (we use 'delay') gem 'savon', '~> 2.7' gem "select2-rails" # makes an autocomplete select box, compatible with x-editable gem 'sidekiq', '~> 2.17.0' # handles background/delayed jobs gem 'spreadsheet', require: false gem "stripe", '~> 1.11.0' gem 'tinymce-rails', '>= 4.0.8' # version 4.0.8 includes important bug fixes gem 'transaction_retry' # Catch mysql deadlock and try again gem 'tzip', '~> 0.0.4' # Find timezone by zip code gem 'whenever', require: false # handles scheduled tasks gem 'wicked_pdf' # creates pdfs from html (is a wrapper for wkhtmltopdf) gem 'will_paginate', '~> 3.0' # paginates index pages for activerecord gem 'wkhtmltopdf-binary' # the backend linux tool that creates pdfs from html using QT Webkit rendering engine #### DON'T JUST ADD GEMS TO THE END OF THIS LIST! ALPHABETIZE! ###
答案 0 :(得分:0)
在需要rails之前,您可能需要捆绑包。如果application.rb
文件中有这两行,则需要按以下顺序排列:
require 'rails/all'
Bundler.require(:default, Rails.env)
答案 1 :(得分:0)
因此,我看到您正在运行rails s
。我知道这个问题很老,但是也许可以帮助其他人。因此,您要运行的命令是:
bundle exec rails s
bundle exec
在包的上下文中执行命令。
此命令执行该命令,使Gemfile
中指定的所有gem对Rails中的require
可用。
基本上,如果您通常运行rspec spec/my_spec.rb
之类的东西,并且想要使用Gemfile
中指定并通过bundle install
安装的gem,则应该运行{{1} }。
请注意,bundle exec rspec spec/my_spec.rb
不需要外壳程序bundle exec
上的可执行文件。