Deep-dive on the Next Gen Platform. Join the Webinar!

Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log inorSign up
Hide categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Node.js Behavior in Heroku
      • Working with Node.js
      • Troubleshooting Node.js Apps
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • Working with PHP
      • PHP Behavior in Heroku
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Working with AI
    • Heroku Inference
      • AI Models
      • Inference Essentials
      • Inference API
      • Quick Start Guides
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Language Support
  • Ruby
  • Working with Ruby
  • Deploying a Ruby Project Generated on Windows

Deploying a Ruby Project Generated on Windows

English — 日本語に切り替える

Last updated December 02, 2024

Table of Contents

  • Background: dependency resolution
  • Bundle install with no lockfile
  • Detection
  • Inconsistent dev-prod parity
  • Cannot resolve Gemfile
  • Mitigation

Heroku’s stacks run on a distribution of Linux, and as a result requires all libraries installed to be Linux compatible. If you are developing on a Windows machine there can be problems when deploying to Linux due to cross OS compatibility issue with dependencies. Developers on a Mac or another Linux distribution will not have the problems described below.

Background: dependency resolution

If you are developing a Ruby application, you use a Gemfile to declare the dependencies that you need. When you run bundle install all of your dependencies are evaluated to see if they can be resolved. Bundler then creates a Gemfile.lock. This file has the exact versions of the dependencies that were installed so that if you give the same Gemfile and Gemfile.lock to someone on another computer and have them run bundle install it should install the exact same versions.

Some gems have decided to create specialized versions to maintain compatibility with windows. When you run bundle install on a Windows machine you may see something that looks like this in the Gemfile.lock:

PLATFORMS
  ruby
  x86-mingw32

This x86-mingw32 line tells bundler that the Gemfile was evaluated on a Windows machine. You may also see mswin instead of mingw. You may or may not notice individual gems that contain a special marker:

sqlite3 (1.3.8-x86-mingw32)

This indicates that this gem is custom for the platform x86-mingw32 or windows.

Because Heroku stacks are based on Linux, this type of gem will not run on Heroku. Due to this problem the previous Gemfile.lock resolution must be discarded and we must run bundle install from scratch.

Bundle install with no lockfile

When a Gemfile.lock is removed before running bundle install all history of libraries and their versions installed is gone. The resolver in bundler must now work to re-generate a new Gemfile.lock and install gems. This has two problems: inconsistency between development and production code, and the potential to have a Gemfile that does not resolve at all.

Detection

When Heroku detects that you a Windows specific Gemfile.lock it will output a warning in line. Check your deploy output for something like this:

Removing `Gemfile.lock` because it was generated on Windows.

Inconsistent dev-prod parity

Without a Gemfile.lock If you have a line in your Gemfile like this:

gem 'rails'

You are stating you want bundler to install any version of Rails. If it detects that you already have 3.2.x installed on your local machine it may decide to use that version, where if you were to install on a co-worker’s machine it may install 4.0.x.

This inconsistency between machines and between development and production is likely to cause errors. You may see strange behavior in production that you cannot re-produce in development. To help avoid that, and achieve dev/prod parity, be as specific as possible in your Gemfile:

gem 'rails', '4.0.1'

This guarantees that Rails 4.0.1 will be installed even if the Gemfile.lock is missing. While it is impossible to do this for all of your dependencies you can use operators such as greater than or equal (>=) or preferably the pessimistic locking operator (~>) to limit the scope of your gem requirements.

The down side to being specific in the Gemfile is that upgrading one gem may cause a gem resolution to fail and you may need to spend some time figuring out exactly how declare the versions of your dependencies manually.

Cannot resolve Gemfile

If your gem versions are too vague, and if those libraries have circular requirements it is possible to get bundler into a state where it cannot resolve your dependencies but continues to try in an infinite loop. If the output after bundle install seems to freeze for many minutes, or continuously outputs dots .......... it may be a sign that it cannot resolve your Gemfile when the Gemfile.lock is removed. In this scenario you likely need to make your gem version requirements more specific to better help bundler do its job and narrow down its search space.

Mitigation

Be as specific in your Gemfile as you possibly can when developing on Windows. If only one developer on your team has a Windows machine, consider not checking in their Gemfile.lock changes or manually bundle installing and committing on a non-Windows machine before deploying.

Keep reading

  • Working with Ruby

Feedback

Log in to submit feedback.

Using WebSockets on Heroku with Ruby Deploying Rack-based Apps

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices