Skip to content
This repository has been archived by the owner. It is now read-only.

Gemfile.lock generated on Windows not usable when deploying to Linux #1610

Closed
leonid-shevtsov opened this issue Jan 4, 2012 · 8 comments
Closed

Comments

@leonid-shevtsov
Copy link

leonid-shevtsov commented Jan 4, 2012

I've spent some time trying to figure out why a junior couldn't deploy a fresh Rails project from a Windows machine (using Capistrano and the official bundler plugin).

Turns out, the Gemfile.lock contained Windows-only versions of all gems with native extensions, like nokogiri or bcrypt-ruby, and on Linux the gems weren't loaded into the bundle at all, without any warning. Specifically, the error message was no such file to load: bcrypt.

The only way to fix this was to check out the project on a Linux machine, run bundle install there - which added Linux versions of the gems to the lock file - and push back the changes. Then deployment worked normally from Windows.

This makes developing on a Windows machine and deploying directly to Linux impossible.

I do understand that this issue might be considered un-fixable for architectural issues, but still I consider it a biggie. This at least requires some notice in the manual.

Related: #635, #966

@indirect
Copy link
Member

indirect commented Jan 4, 2012

Yes. Bundler requires that you install your bundle on the platform you are deploying to. That means You either have to delete the Windows-generated Gemfile.lock before deploying, or run install on a Linux box before deploying.

This has been a consistent situation (and suggested workaround) since Bundler first started supporting Windows. The main problem with transparently supporting Windows is that it often requires an entirely different set of gems. This defeats the purpose of the Gemfile.lock, unfortunately. :(

On Jan 4, 2012, at 5:13 AM, Leonid Shevtsovreply@reply.github.com wrote:

I've spent some time trying to figure out why a junior couldn't deploy a fresh Rails project from a Windows machine (using Capistrano and the official bundler plugin).

Turns out, the Gemfile.lock contained Windows-only versions of all gems with native extensions, like nokogiri or bcrypt-ruby, and on Linux the gems weren't loaded into the bundle at all.

The only way to fix this was to check out the project on a Linux machine, run bundle install there - which added Linux versions of the gems to the lock file - and push back the changes. Then deployment worked normally from Windows.

This makes developing on a Windows machine and deploying directly to Linux impossible.

I do understand that this issue might be considered un-fixable for architectural issues, but still I consider it a biggie. This at least requires some notice in the manual.

Related: #635, #966


Reply to this email directly or view it on GitHub:
#1610

@hoffmanc
Copy link

hoffmanc commented Sep 25, 2012

How does one then maintain Gemfile.lock under version control when doing cross-platform development? Do I instruct my windows-wielding teammates to never version control this file? What if they add a new gem?

@indirect
Copy link
Member

indirect commented Sep 25, 2012

Unfortunately, this isn't solved yet. It's something that needs to be done, and is on the road map, but isn't implemented. For now, lock files with native gems are only usable on the platform that created them.

On Sep 25, 2012, at 6:37 AM, Chris Hoffman notifications@github.com wrote:

How does one then maintain Gemfile.lock under version control when doing cross-platform development? Do I instruct my windows-wielding teammates to never version control this file? What if they add a new gem?


Reply to this email directly or view it on GitHub.

@e0da
Copy link

e0da commented Apr 12, 2013

I'm surprised and bummed that this doesn't have a milestone. This is very common and often painful shortcoming.

@thibaudgg
Copy link

thibaudgg commented Apr 13, 2013

Yeah me too, any progress on that side?

@VorontsovIE
Copy link

VorontsovIE commented May 6, 2013

May be bundler should not at least reinstall gems that are already installed for another platform. I have bcrypt-ruby, sqlite3 and mysql2 gems installed with switch --platform ruby but bundler each time reinstalls precompiled versions (which doesn't work)

@Ajedi32
Copy link

Ajedi32 commented Jun 6, 2013

I think this is a duplicate of #646.

@ixti
Copy link
Contributor

ixti commented Jul 17, 2013

Duplicates #646. Any further discussion should go there.

@ixti ixti closed this as completed Jul 17, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants