[英]Could not find gem 'rails (= 4.2.5) x86-mingw32' when running rails server
I'm trying to learn Ruby on Rails.我正在尝试学习 Ruby on Rails。 Currently been trying out Rails framework.
目前正在试用 Rails 框架。 I've installed it.
我已经安装了。 Create new project in MyBlog folder, but when I try to run:
在 MyBlog 文件夹中创建新项目,但是当我尝试运行时:
rails server
I get back an error:我得到一个错误:
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.
I've installed bundle as suggested.我已经按照建议安装了 bundle。 Had few problems with installing it as well, but I've found a soultion on the internet.
安装它也几乎没有问题,但我在互联网上找到了一个解决方案。
Before bundle install I was getting another error saying that it could not find gem 'sqlite3'在 bundle install 之前,我收到另一个错误,说它找不到 gem 'sqlite3'
Did someone had similar problem?有人遇到过类似的问题吗? Can you help me with solving it?
你能帮我解决吗?
Update:更新:
Content of my Gemfile is:我的 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]
Errors when try to run 'bundle install':尝试运行“捆绑安装”时出错:
Try to install the following packages to succeed bundle install尝试安装以下软件包以成功捆绑安装
sudo apt-get install build-essential
sudo apt-get install libgmp3-dev
These packages are for Linux environment.这些软件包适用于 Linux 环境。 Find the alternatives for other environments.
寻找其他环境的替代方案。 Let me know if you got any error.
如果您有任何错误,请告诉我。
open file Gemfile.lock, find and delete "x64-mingw32" then run the command:-打开文件 Gemfile.lock,找到并删除“x64-mingw32”,然后运行命令:-
$bundle install $bundle 安装
Late answer but this happened to me just now.迟到的答案,但这刚刚发生在我身上。 What worked for me was figuring out I accidently installed an older Ruby version.
对我有用的是发现我不小心安装了旧的 Ruby 版本。
In your last screenshot you received a line:在上一个屏幕截图中,您收到了一行:
Make sure that `gem install json -v '1.8.3'` succeeds before bundling
This command probably failed due to an older Ruby version, get the latest version here (Assuming you're a windows user) https://rubyinstaller.org/downloads/此命令可能由于较旧的 Ruby 版本而失败,请在此处获取最新版本(假设您是 Windows 用户) https://rubyinstaller.org/downloads/
PS聚苯乙烯
Make sure you remove any previous Ruby / Rails installations.确保删除任何以前的 Ruby / Rails 安装。 What you need is a "With DEVKIT" installer, preferably the one they recommend on (starts with "=>").
您需要的是“With DEVKIT”安装程序,最好是他们推荐的安装程序(以“=>”开头)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.