jjzjj

mysql - rake 中止!无法加载此类文件 -- El Capitan 上的 mysql2/mysql2

coder 2023-10-06 原文

从过去两周开始,我一直在尝试在 Mac 上设置我的代码。以前我使用的是 Ubuntu,设置代码从来没有这么困难。我几乎遵循了所有教程,但没有运气。请任何人指导我在 Mac 上设置 RoR。完成所有教程后,我最终只遇到 mysql 错误。

rake aborted!
cannot load such file -- mysql2/mysql2
/Users/sahil/Documents/work/ccprod/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `require'
/Users/sahil/Documents/work/ccprod/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `block in require'
/Users/sahil/Documents/work/ccprod/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/sahil/Documents/work/ccprod/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `require'
/Users/sahil/Documents/work/ccprod/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.14/lib/mysql2.rb:8:in `<top (required)>'
/Users/sahil/.rvm/gems/ruby-1.9.3-p551@global/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
/Users/sahil/.rvm/gems/ruby-1.9.3-p551@global/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/Users/sahil/.rvm/gems/ruby-1.9.3-p551@global/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
/Users/sahil/.rvm/gems/ruby-1.9.3-p551@global/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
/Users/sahil/.rvm/gems/ruby-1.9.3-p551@global/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
/Users/sahil/.rvm/gems/ruby-1.9.3-p551@global/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
/Users/sahil/.rvm/gems/ruby-1.9.3-p551@global/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
/Users/sahil/Documents/work/ccprod/config/application.rb:9:in `<top (required)>'
/Users/sahil/Documents/work/ccprod/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

如果需要任何其他信息,请告诉我。 MySQL 从 mysql 网站安装。其他详细信息:

Server version: 5.5.46 MySQL Community Server (GPL)

更新: Gemfile.lock 文件:

GIT
  remote: git://github.com/acumenbrands/acts_as_slugable.git
  revision: 51c739b8dc283483e8cb68be2f48f0742dadbf3d
  specs:
    acts_as_slugable (1.0)
      activerecord (>= 3.0.0)

GIT
  remote: git://github.com/paneq/calendar_date_select.git
  revision: 977048211b94599fe0f08eb37a481f3d69df48f6
  specs:
    calendar_date_select (1.16.2)

GIT
  remote: git://github.com/rails/prototype_legacy_helper.git
  revision: a2cd95c3e3c1a4f7a9566efdab5ce59c886cb05f
  specs:
    prototype_legacy_helper (0.0.0)

GIT
  remote: https://github.com/Gonzih/respond_to_parent.git
  revision: e7399307d70d00951916fd5e396c919cd7bb7f77
  specs:
    respond_to_parent (0.0.3)
      rails (~> 3.2)

GIT
  remote: https://github.com/jwhitehorn/acts_as_versioned.git
  revision: 44dfe632ba8c97c786cbc172a2da18a41b17f668
  specs:
    acts_as_versioned (3.2.1)
      activerecord

GEM
  remote: http://rubygems.org/
  specs:
    actionmailer (3.2.14)
      actionpack (= 3.2.14)
      mail (~> 2.5.4)
    actionpack (3.2.14)
      activemodel (= 3.2.14)
      activesupport (= 3.2.14)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.5)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.2.1)
    active_scaffold (3.3.3)
      rails (~> 3.2.0)
    activemodel (3.2.14)
      activesupport (= 3.2.14)
      builder (~> 3.0.0)
    activerecord (3.2.14)
      activemodel (= 3.2.14)
      activesupport (= 3.2.14)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.14)
      activemodel (= 3.2.14)
      activesupport (= 3.2.14)
    activesupport (3.2.14)
      i18n (~> 0.6, >= 0.6.4)
      multi_json (~> 1.0)
    acts-as-taggable-on (3.0.0)
      rails (>= 3, < 5)
    addressable (2.3.5)
    arel (3.0.3)
    asset_sync (1.0.0)
      activemodel
      fog (>= 1.8.0)
    atomic (1.1.14)
    autoparse (0.3.3)
      addressable (>= 2.3.1)
      extlib (>= 0.9.15)
      multi_json (>= 1.0.0)
    aws-sdk (1.31.3)
      json (~> 1.4)
      nokogiri (>= 1.4.4)
      uuidtools (~> 2.1)
    axiom-types (0.1.0)
      descendants_tracker (~> 0.0.3)
      ice_nine (~> 0.11.0)
      thread_safe (~> 0.1.3)
    babosa (0.3.11)
    bcrypt-ruby (3.1.2)
    better_errors (1.1.0)
      coderay (>= 1.0.0)
      erubis (>= 2.6.6)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    builder (3.0.4)
    bullet (4.7.1)
      activesupport
      uniform_notifier (>= 1.4.0)
    canonix (0.1.1)
    carrierwave (0.9.0)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
      json (>= 1.7)
    celluloid (0.15.2)
      timers (~> 1.1.0)
    chartkick (1.3.2)
    chronic (0.10.2)
    ckeditor (4.0.7)
      mime-types
      orm_adapter
    climate_control (0.0.3)
      activesupport (>= 3.0)
    cocaine (0.5.3)
      climate_control (>= 0.0.3, < 1.0)
    coderay (1.1.0)
    coercible (1.0.0)
      descendants_tracker (~> 0.0.1)
    coffee-rails (3.2.2)
      coffee-script (>= 2.2.0)
      railties (~> 3.2.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.6.3)
    commonjs (0.2.7)
    connection_pool (1.2.0)
    crack (0.4.1)
      safe_yaml (~> 0.9.0)
    daemons (1.1.9)
    debug_inspector (0.0.2)
    delayed_job (4.0.0)
      activesupport (>= 3.0, < 4.1)
    delayed_job_active_record (4.0.0)
      activerecord (>= 3.0, < 4.1)
      delayed_job (>= 3.0, < 4.1)
    delayed_job_web (1.2.10)
      activerecord (> 3.0.0)
      delayed_job (> 2.0.3)
      sinatra (>= 1.4.4)
    descendants_tracker (0.0.3)
    devise (3.2.2)
      bcrypt-ruby (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    devise-encryptable (0.1.2)
      devise (>= 2.1.0)
    dotenv (0.9.0)
    dynamic_form (1.1.4)
    equalizer (0.0.9)
    erubis (2.7.0)
    event-calendar (2.3.3)
    eventmachine (1.0.3)
    exception_notification (4.0.1)
      actionmailer (>= 3.0.4)
      activesupport (>= 3.0.4)
    excon (0.31.0)
    execjs (2.0.2)
    extlib (0.9.16)
    faraday (0.8.8)
      multipart-post (~> 1.2.0)
    fattr (2.2.1)
    fog (1.19.0)
      builder
      excon (~> 0.31.0)
      formatador (~> 0.2.0)
      mime-types
      multi_json (~> 1.0)
      net-scp (~> 1.1)
      net-ssh (>= 2.1.3)
      nokogiri (~> 1.5)
      ruby-hmac
    font-awesome-rails (4.2.0.0)
      railties (>= 3.2, < 5.0)
    foreman (0.63.0)
      dotenv (>= 0.7)
      thor (>= 0.13.6)
    formatador (0.2.4)
    god (0.13.4)
    google-api-client (0.6.4)
      addressable (>= 2.3.2)
      autoparse (>= 0.3.3)
      extlib (>= 0.9.15)
      faraday (~> 0.8.4)
      jwt (>= 0.1.5)
      launchy (>= 2.1.1)
      multi_json (>= 1.0.0)
      signet (~> 0.4.5)
      uuidtools (>= 2.1.0)
    grape (0.11.0)
      activesupport
      builder
      hashie (>= 2.1.0)
      multi_json (>= 1.3.2)
      multi_xml (>= 0.5.2)
      rack (>= 1.3.0)
      rack-accept
      rack-mount
      virtus (>= 1.0.0)
    hashie (3.4.0)
    highline (1.6.20)
    hike (1.2.3)
    httpauth (0.2.0)
    i18n (0.6.9)
    ice_nine (0.11.1)
    journey (1.0.4)
    jquery-rails (3.0.4)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    json (1.8.1)
    jwt (0.1.8)
      multi_json (>= 1.5)
    launchy (2.4.2)
      addressable (~> 2.3)
    less (2.5.1)
      commonjs (~> 0.2.7)
    less-rails (2.5.0)
      actionpack (>= 3.1)
      less (~> 2.5.0)
    libv8 (3.16.14.3)
    macaddr (1.6.1)
      systemu (~> 2.5.0)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    memcache-client (1.8.5)
    mime-types (1.25.1)
    mini_magick (3.7.0)
      subexec (~> 0.2.1)
    mono_logger (1.1.0)
    multi_json (1.8.2)
    multi_xml (0.5.5)
    multipart-post (1.2.0)
    mysql2 (0.3.14)
    net-scp (1.1.2)
      net-ssh (>= 2.6.5)
    net-ssh (2.8.0)
    nokogiri (1.5.9)
    oauth (0.4.7)
    oauth2 (0.9.2)
      faraday (~> 0.8)
      httpauth (~> 0.2)
      jwt (~> 0.1.4)
      multi_json (~> 1.0)
      multi_xml (~> 0.5)
      rack (~> 1.2)
    options (2.3.0)
      fattr
    orm_adapter (0.5.0)
    paperclip (3.5.2)
      activemodel (>= 3.0.0)
      activesupport (>= 3.0.0)
      cocaine (~> 0.5.3)
      mime-types
    polyglot (0.3.3)
    pr_geohash (1.0.0)
    progress_bar (1.0.0)
      highline (~> 1.6.1)
      options (~> 2.3.0)
    prototype-rails (3.2.1)
      rails (~> 3.2)
    rack (1.4.5)
    rack-accept (0.4.5)
      rack (>= 0.4)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-mount (0.8.3)
      rack (>= 1.0.0)
    rack-protection (1.5.3)
      rack
    rack-ssl (1.3.3)
      rack
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (3.2.14)
      actionmailer (= 3.2.14)
      actionpack (= 3.2.14)
      activerecord (= 3.2.14)
      activeresource (= 3.2.14)
      activesupport (= 3.2.14)
      bundler (~> 1.0)
      railties (= 3.2.14)
    rails-dev-tweaks (0.6.1)
      actionpack (~> 3.1)
      railties (~> 3.1)
    rails_autolink (1.1.5)
      rails (> 3.1)
    railties (3.2.14)
      actionpack (= 3.2.14)
      activesupport (= 3.2.14)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    rake (10.1.1)
    rdoc (3.12.2)
      json (~> 1.4)
    redis (3.0.6)
    redis-namespace (1.4.1)
      redis (~> 3.0.4)
    ref (1.0.5)
    resque (1.25.2)
      mono_logger (~> 1.0)
      multi_json (~> 1.0)
      redis-namespace (~> 1.3)
      sinatra (>= 0.9.2)
      vegas (~> 0.1.2)
    resque-web (0.0.6)
      coffee-rails
      jquery-rails
      resque
      sass-rails
      twitter-bootstrap-rails
    roo (1.13.2)
      nokogiri
      rubyzip
      spreadsheet (> 0.6.4)
    rsolr (1.0.9)
      builder (>= 2.1.2)
    ruby-hmac (0.4.0)
    ruby-ole (1.2.11.7)
    ruby-saml (0.7.2)
      canonix (= 0.1.1)
      nokogiri
      uuid (~> 2.3)
    rubyzip (1.1.0)
    safe_yaml (0.9.7)
    sass (3.2.13)
    sass-rails (3.2.6)
      railties (~> 3.2.0)
      sass (>= 3.1.10)
      tilt (~> 1.3)
    sentimental (1.0.3)
    sidekiq (2.17.2)
      celluloid (>= 0.15.2)
      connection_pool (>= 1.0.0)
      json
      redis (>= 3.0.6)
      redis-namespace (>= 1.3.1)
    signet (0.4.5)
      addressable (>= 2.2.3)
      faraday (~> 0.8.1)
      jwt (>= 0.1.5)
      multi_json (>= 1.0.0)
    simple_oauth (0.2.0)
    sinatra (1.4.5)
      rack (~> 1.4)
      rack-protection (~> 1.4)
      tilt (~> 1.3, >= 1.3.4)
    spreadsheet (0.9.6)
      ruby-ole (>= 1.0)
    sprockets (2.2.2)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    subexec (0.2.3)
    sunspot (2.1.0)
      pr_geohash (~> 1.0)
      rsolr (~> 1.0.7)
    sunspot-queue (0.10.2)
      sunspot_rails (>= 1.3.0)
    sunspot_rails (2.1.0)
      nokogiri
      rails (>= 3)
      sunspot (= 2.1.0)
    sunspot_solr (2.1.0)
    systemu (2.5.2)
    therubyracer (0.12.1)
      libv8 (~> 3.16.14.0)
      ref
    thin (1.6.1)
      daemons (>= 1.0.9)
      eventmachine (>= 1.0.0)
      rack (>= 1.0.0)
    thor (0.18.1)
    thread_safe (0.1.3)
      atomic
    tilt (1.4.1)
    timers (1.1.0)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    turbo-sprockets-rails3 (0.3.11)
      railties (> 3.2.8, < 4.0.0)
      sprockets (>= 2.2.0)
    twitter-bootstrap-rails (2.2.8)
      actionpack (>= 3.1)
      execjs
      rails (>= 3.1)
      railties (>= 3.1)
    tzinfo (0.3.38)
    uglifier (2.4.0)
      execjs (>= 0.3.0)
      json (>= 1.8.0)
    uniform_notifier (1.4.0)
    uuid (2.3.7)
      macaddr (~> 1.0)
    uuidtools (2.1.4)
    vegas (0.1.11)
      rack (>= 1.0.0)
    virtus (1.0.4)
      axiom-types (~> 0.1)
      coercible (~> 1.0)
      descendants_tracker (~> 0.0, >= 0.0.3)
      equalizer (~> 0.0, >= 0.0.9)
    warden (1.2.3)
      rack (>= 1.0)
    webmock (1.16.1)
      addressable (>= 2.2.7)
      crack (>= 0.3.2)
    whenever (0.9.0)
      activesupport (>= 2.3.4)
      chronic (>= 0.6.3)
    wicked_pdf (0.11.0)
      rails
    will_paginate (3.0.7)
    will_paginate-bootstrap (1.0.1)
      will_paginate (>= 3.0.3)
    wkhtmltopdf-binary (0.9.9.3)
    youtube_it (2.3.2)
      builder
      excon
      faraday (~> 0.8)
      json (~> 1.8.0)
      nokogiri (~> 1.5.2)
      oauth (~> 0.4.4)
      oauth2 (~> 0.6)
      simple_oauth (>= 0.1.5)
      webmock

PLATFORMS
  ruby

DEPENDENCIES
  active_scaffold
  acts-as-taggable-on
  acts_as_slugable!
  acts_as_versioned!
  asset_sync
  aws-sdk
  babosa
  better_errors
  binding_of_caller
  bullet
  calendar_date_select!
  carrierwave
  chartkick
  ckeditor
  coderay
  coffee-rails
  delayed_job_active_record
  delayed_job_web
  devise
  devise-encryptable
  dynamic_form
  event-calendar
  exception_notification
  font-awesome-rails
  foreman
  god
  google-api-client
  grape
  jquery-rails
  less-rails
  memcache-client
  mini_magick
  mysql2 (>= 0.3)
  nokogiri (= 1.5.9)
  paperclip
  progress_bar
  prototype-rails
  prototype_legacy_helper (= 0.0.0)!
  rails (= 3.2.14)
  rails-dev-tweaks (~> 0.6.1)
  rails_autolink
  respond_to_parent!
  resque
  resque-web
  roo
  ruby-saml
  sass-rails
  sentimental
  sidekiq
  sunspot-queue
  sunspot_rails
  sunspot_solr
  therubyracer
  thin
  turbo-sprockets-rails3
  uglifier
  whenever
  wicked_pdf
  will_paginate (~> 3.0)
  will_paginate-bootstrap
  wkhtmltopdf-binary
  youtube_it

数据库.yml:

# MySQL.  Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
#   gem install mysql2
#
# And be sure to use new-style password hashing:
#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: db_development
  pool: 5
  username: root
  password: xyz
  socket: /var/run/mysqld/mysqld.sock

在 Ubuntu 中设置 Rails 的步骤:

Installation of rvm and ruby in 12.04(Followed the link) 
https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm 
the steps are: 

sudo apt-get update 
sudo apt-get install curl 
\curl -L https://get.rvm.io | bash -s stable 
source ~/.rvm/scripts/rvm 
rvm requirements(error will occur - not to worry. Go to the link provided to install the package-----) 
rvm autolibs rvm_pkg
again give -> rvm requirements 
rvm install 1.9.3 
rvm use 1.9.3 



get the code and do inside it
bundle install 

later check with rails s.. if not working. do as follows 
gem uninstall -i /home/user_xyz/.rvm/gems/ruby-1.9.3-p448@global bundler 

then install 
gem install bundler -v1.0.22 

install git 
sudo apt-get install git 
 then 
bundle install --system 

then again do 
bundle install 

If the bundle install --system is not working 
gem install bundler --pre 

again give 
bundle install --system 

It will ask to install the mysql2 
install the mysql2 
sudo apt-get install mysql2 -v0.3.13 

again give 
bundle install --system 

then install the following for the mysql error 
sudo apt-get install libmysql-ruby libmysqlclient-dev 

After the mysql error. nokogiri error occurs 
sudo apt-get install libxslt-dev libxml2-dev 
sudo gem install nokogiri 

finally give 
bundle install --system 

install netbeans 
first install java package 
sudo apt-get install openjdk-7-jdk 
sh netbeans-7.0.1-ml-linux.sh 

Proceed as follows(Due to erros do the following)
gem uninstall bundler 
bundle install 
rvm @global do gem uninstall bundler 
gem update bundle 
bundle install --system 
Error for event machine(Check the link: http://stackoverflow.com/questions/4735303/failed-to-install-gem-install-eventmachine-i-need-starling-in-my-project-fo) 
sudo apt-get install build-essential 
install event machine 
gem install eventmachine -v '1.0.3' 
bundle install --system 

install mysql 
sudo apt-get install mysql-server 
change the password in the config/database.yml for the mysql

解决方案: 设置 Rails 的步骤:

  • 使用 brew 安装 MySQL:mysql Ver 14.14 Distrib 5.7.9,用于 osx10.11 (x86_64) 使用 EditLine 包装器。安装 mysql 后按照屏幕上给出的命令进行操作。

  • 按照以下步骤安装了 rvm:

    \curl -L https://get.rvm.io | bash -s stable —ruby

    rvm 安装 1.9.3

    rvm 使用 1.9.3

    rvm --default 1.9.3

  • 已安装 rails,gem install rails,当前版本为 '4.2.5'

(mysql2 gem version (0.3.20) woking with rails 4.1.4)

(mysql2 gem version (0.4.2) woking with rails 4.2.5)

(mysql2 gem version (0.3.20) woking with rails 3.2.14)

因此,现在我能够创建和运行新的 Rails 应用程序,但是如果我运行任何基于 Ubuntu 构建的旧 Rails 应用程序,即使捆绑安装成功完成,它也会不断抛出错误。我收到的错误消息:

Gem::LoadError: Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).

错误消息不断变化,但都与 mysql2 gem 有关。我已经从我的旧项目中删除了 vendor/cacheGemfile.lock,但仍然没有成功。

最佳答案

这个问题确实敲响了警钟,但我没有挖掘互联网和我的内存,而是尝试了以下方法:安装最新的 mysql2 of the 0.3 series (0.3.20 at time of写作),并将其打包用于应用程序。

问题似乎是最新的 mysql2 gem 版本 0.4 与 Rails 3 不兼容。


您的 gem 版本无法更改,并且您希望拥有与生产版本相同的版本。为此,您只需从生产服务器复制 Gemfile.lock 文件,将其放在 Gemfile 旁边的本地文件夹中,然后执行 bundle安装命令。

请注意,如果您的 Gemfile 指定:

gem 'mysql2', '> 0.3'

然后 Bundler 将安装与 0.n 匹配的最新版本,其中 n >= 3。在撰写本文时,这导致 Bundler 获得一个 0.4 版本,该版本与您的 Rails 版本不兼容(Bundler 无法从您的 Gemfile 中推断出这一点)。您的解决方法是修改您的 Gemfile 副本(并将其提交到您的项目可能是个好主意):

gem 'mysql2', '> 0.3.13'  # put here the actual version used in production

这样做,Bundler 将安装与 0.3.n 匹配的版本,n >= 13

关于mysql - rake 中止!无法加载此类文件 -- El Capitan 上的 mysql2/mysql2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33936671/

有关mysql - rake 中止!无法加载此类文件 -- El Capitan 上的 mysql2/mysql2的更多相关文章

  1. ruby - 其他文件中的 Rake 任务 - 2

    我试图在一个项目中使用rake,如果我把所有东西都放到Rakefile中,它会很大并且很难读取/找到东西,所以我试着将每个命名空间放在lib/rake中它自己的文件中,我添加了这个到我的rake文件的顶部:Dir['#{File.dirname(__FILE__)}/lib/rake/*.rake'].map{|f|requiref}它加载文件没问题,但没有任务。我现在只有一个.rake文件作为测试,名为“servers.rake”,它看起来像这样:namespace:serverdotask:testdoputs"test"endend所以当我运行rakeserver:testid时

  2. ruby-on-rails - 由于 "wkhtmltopdf",PDFKIT 显然无法正常工作 - 2

    我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-

  3. ruby-on-rails - 无法使用 Rails 3.2 创建插件? - 2

    我对最新版本的Rails有疑问。我创建了一个新应用程序(railsnewMyProject),但我没有脚本/生成,只有脚本/rails,当我输入ruby./script/railsgeneratepluginmy_plugin"Couldnotfindgeneratorplugin.".你知道如何生成插件模板吗?没有这个命令可以创建插件吗?PS:我正在使用Rails3.2.1和ruby​​1.8.7[universal-darwin11.0] 最佳答案 随着Rails3.2.0的发布,插件生成器已经被移除。查看变更日志here.现在

  4. ruby - 无法运行 Rails 2.x 应用程序 - 2

    我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby​​:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r

  5. ruby - 如何在续集中重新加载表模式? - 2

    鉴于我有以下迁移:Sequel.migrationdoupdoalter_table:usersdoadd_column:is_admin,:default=>falseend#SequelrunsaDESCRIBEtablestatement,whenthemodelisloaded.#Atthispoint,itdoesnotknowthatusershaveais_adminflag.#Soitfails.@user=User.find(:email=>"admin@fancy-startup.example")@user.is_admin=true@user.save!ende

  6. ruby-on-rails - 无法在centos上安装therubyracer(V8和GCC出错) - 2

    我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e

  7. ruby - 如何使用 RSpec::Core::RakeTask 创建 RSpec Rake 任务? - 2

    如何使用RSpec::Core::RakeTask初始化RSpecRake任务?require'rspec/core/rake_task'RSpec::Core::RakeTask.newdo|t|#whatdoIputinhere?endInitialize函数记录在http://rubydoc.info/github/rspec/rspec-core/RSpec/Core/RakeTask#initialize-instance_method没有很好的记录;它只是说:-(RakeTask)initialize(*args,&task_block)AnewinstanceofRake

  8. ruby - 无法让 RSpec 工作—— 'require' : cannot load such file - 2

    我花了三天的时间用头撞墙,试图弄清楚为什么简单的“rake”不能通过我的规范文件。如果您遇到这种情况:任何文件夹路径中都不要有空格!。严重地。事实上,从现在开始,您命名的任何内容都没有空格。这是我的控制台输出:(在/Users/*****/Desktop/LearningRuby/learn_ruby)$rake/Users/*******/Desktop/LearningRuby/learn_ruby/00_hello/hello_spec.rb:116:in`require':cannotloadsuchfile--hello(LoadError) 最佳

  9. ruby-on-rails - date_field_tag,如何设置默认日期? [ rails 上的 ruby ] - 2

    我想设置一个默认日期,例如实际日期,我该如何设置?还有如何在组合框中设置默认值顺便问一下,date_field_tag和date_field之间有什么区别? 最佳答案 试试这个:将默认日期作为第二个参数传递。youcorrectlysetthedefaultvalueofcomboboxasshowninyourquestion. 关于ruby-on-rails-date_field_tag,如何设置默认日期?[rails上的ruby],我们在StackOverflow上找到一个类似的问

  10. ruby-on-rails - openshift 上的 rails 控制台 - 2

    我将我的Rails应用程序部署到OpenShift,它运行良好,但我无法在生产服务器上运行“Rails控制台”。它给了我这个错误。我该如何解决这个问题?我尝试更新ruby​​gems,但它也给出了权限被拒绝的错误,我也无法做到。railsc错误:Warning:You'reusingRubygems1.8.24withSpring.UpgradetoatleastRubygems2.1.0andrun`gempristine--all`forbetterstartupperformance./opt/rh/ruby193/root/usr/share/rubygems/rubygems

随机推荐