【问题标题】:Could not find gem 'rails (= 4.2.5) x86-mingw32' when running rails server运行 rails server 时找不到 gem 'rails (= 4.2.5) x86-mingw32'
【发布时间】:2016-02-20 00:04:04
【问题描述】:

我正在尝试学习 Ruby on Rails。 目前正在试用 Rails 框架。我已经安装了它。在 MyBlog 文件夹中创建新项目,但是当我尝试运行时:

rails server

我得到一个错误:

Could not find gem 'rails (= 4.2.5) x86-mingw32' in any of the gem sources listed in your Gemfile or available on this machine. Run `bundle install` to install missing gems.

我已按照建议安装了捆绑包。安装它也没有什么问题,但我在互联网上找到了一个灵魂。

在捆绑安装之前,我收到另一个错误,说它找不到 gem 'sqlite3'

有人遇到过类似的问题吗?你能帮我解决一下吗?

更新:

我的 Gemfile 的内容是:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

尝试运行“捆绑安装”时出错:

【问题讨论】:

  • 您遇到了问题,但使用建议的解决方案解决了它。伟大的。但是你之前有另一个问题吗?你还拥有它吗?我跟不上。你的实际问题是什么?你现在面临什么问题?
  • @spickermann 当我运行'rails server'命令时,问题是没有创建rails gem。
  • 您能发布您的 gem 文件和捆绑安装错误吗?
  • @SaravanaKumAr 当然,我会立即编辑我的帖子。

标签: ruby-on-rails ruby ruby-on-rails-3 rubygems


【解决方案1】:

尝试安装以下包以成功安装包

sudo apt-get install build-essential
sudo apt-get install libgmp3-dev

这些软件包适用于 Linux 环境。寻找其他环境的替代品。如果您有任何错误,请告诉我。

【讨论】:

  • 我试过 gem install build-essentials... 但我想这不是适合你为 Unix 提供的 Windows 命令。我得到了这个:C:\Users\n.mosorinski\Rails\apps\MyBlog>gem install build-essential 错误:在任何存储库中找不到有效的 gem 'build-essential' (>= 0) 错误:可能的替代方案:刀必备,build_eval,要领,spree_e ssentials
  • 我已经在答案中提到了
【解决方案2】:

打开文件Gemfile.lock,找到并删除“x64-mingw32”然后运行命令:-

$bundle 安装

【讨论】:

    【解决方案3】:

    迟到的答案,但这刚刚发生在我身上。 对我有用的是弄清楚我不小心安装了一个旧的 Ruby 版本。

    在您的上一个屏幕截图中,您收到了一行:

    Make sure that `gem install json -v '1.8.3'` succeeds before bundling

    此命令可能由于 Ruby 版本较旧而失败,请在此处获取最新版本(假设您是 windows 用户)https://rubyinstaller.org/downloads/

    附言

    确保删除任何以前的 Ruby / Rails 安装。 您需要的是“With DEVKIT”安装程序,最好是他们推荐的安装程序(以“=>”开头)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-06-27
      • 2012-03-29
      • 1970-01-01
      • 1970-01-01
      • 2011-10-07
      • 2010-10-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多