I have a rails application that I deploy on Heroku. I'm using several different machines, and I noticed that when I add new dependencies (so that Gemfile.lock is rebuilt) and do bundle install on my Windows computer at home, push to Heroku fails with the following error:
Unresolved dependencies detected; Installing...
Windows Gemfile.lock detected, ignoring it.
You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control
...
Gemfile.lock IS under version control, but Heroku appearently chooses to ignore it since it's created in Windows, and then complains that it's missing seconds later. Why does this happen? And how can I solve it?
I fixed mine by opening Gemfile.lock and deleting the following two lines:
PLATFORMS
x86-mingw32
So now i just need to make a script that bundles then removes that from the lock file.
Like matt commented above:
The problem is that Bundler creates different Gemfile.locks for Windows. The only solution is to create and commit the lock file on a *NIX system.
I would suggest to create a virtual machine running e.g. Ubuntu – maybe using Virtual Box. You can even get ready-to-use virtual machines – for example here.
From the Heroku Docs:
If the platforms section of your Gemfile contains Windows entries,
such as mswin or mingw, then the Gemfile.lock file will be ignored.
Just battled through this problem for a while.
I trimmed my gemfile back to just rails and still had the issue. Then, thinking that heroku had demanded an update of the heroku gem today, I looked closer at heroku changes.
It seems the 1.9.2 ruby "bamboo" stack is now the default one - my app is still running on the 1.8.7 stack. So I ran "heroku stack:migrate bamboo-mri-1.9.2" and updated the stack to 1.9.2 - not something I wanted to do, but you know what, it fixed the issue above.
Of course, I didn't want to be on the 1.9.2 stack, so I migrated back down to the 1.8.7 stack, and things installed correctly again. So I think this is a workaround - and probably an overly complex one - but it seemed to "flush" whatever the error was heroku-side. As nothing I did locally (and I tried a LOT of things from StackOverflow articles) had any effect, the push just kept failing as above.
So yeah, this fixes it. Doesn't take too long either. But suspect a better workaround may be spotted by more heroku-knowledgeable developers !
Make sure you commit the changes to Gemfile.lock after installing the bundle. On your next push to Heroku, the new gems should be installed correctly.
Related
I am setting a new app, stack is:
ruby: 2.6.1 (using rvm)
rails: 5.2.2
bundler: 2.0.1
Now thing is, bundler 2 doesn't use Gemfile at all, i have proper gems.rb and gems.locked and everything was working properly until i pulled some code from a co-worker which got merged.
Issue is whenever i run any rake or rails command i get this error:
/path/to/proj/Gemfile not found
I then even tried going back to old master when that code was not merged and issue is still there. So it is probably not something in the code i pulled.
And issue seems persistent in different machines.
I know there are other issues which have similar errors of Gemfile not found but those are mostly those which had wrong directory opened or some gem issued fixed by bundle update or gem update type commands, this is not that issue because. This is something else, because bundler 2 doesn't even need Gemfile.
It looks like rails doesn't support using gems.rb and gems.locked. https://github.com/rails/rails/issues/31295
You could try what that guy did and edit some files, or you could rename your gems.rb back to Gemfile and gems.locked back to Gemfile.lock
I have an instance of Locomotive CMS running on Heroku and it has been running fine for about a year. I am the only developer so there have been no deployments since the last working deployment.
Yesterday I made an update to the config/environments/production.rb - all that I changed were the values for the existing ActionMailer settings. Committed and pushed, et voila - the app no longer functions.
The app works on the dev machine, when run in production and dev mode.
I'm a newb when it comes to Rails and Heroku, so I'm having some difficulty interpreting the log.
I've posted the log at: http://pastebin.com/GZpRaue6
The only clear error that I can see in the log is:
Couldn't load redcloth_scan
I have tried adding gem 'RedCloth' to my gems file and bundle installed, as it wasn't explicitly required in the original version of the source, but this has made no difference.
There is no mention of redcloth_scan in my gemfile.lock, but RedCloth is listed as a dependency of Locomotive.
locomotive_cms (2.0.0.rc9)
RedCloth (~> 4.2.8)
After much messing about with the gemfile, each gemfile alteration simply causing different problems with loading the binaries for a different gem. So not an issue specific to redcloth.
I came across this SO post: What is the purpose of vendor/bundle? Heroku tells me to remove it
This use of --path is certainly not an elegant solution, my app never needed this before - something must have changed in Heroku and I'm hoping to be able to move away from this in future. But it's fixed it for now and that's good enough for me.
Bit of a strange question, but here goes.
I'm a relative beginner to rails, and I've just started working on my second app locally. However, after each install I'm getting the following problem - that several gemfiles are missing (railties being the most obvious).
So, I deleted the install, re-ran it and listed the gemfiles - they are all there. However, after initializing a git repo and pushing the project up to my GitHub a gem list command shows that a number of gems are now missing - at this point I can't run any rake commands or for example rails server.
So I cleared the repo and re-installed. gem list says the gems are all present, server and rake commands work; but push the repo and it subsequently packs up - gem list shows only a handful of gems remain.
Bearing in mind my experience, I'm prepared to believe I'm missing something very obvious, but any advice would be appreciated.
welcome ;-)
I suppose you want to create a Rails 3 application. So first make sure you have installed bundler.
gem install bundler
The steps for creating the application are:
rails new your_app
Then run bundler in the applications folder:
cd your_app
bundler install
Now you should be able to run the application:
rails s
Go and visit localhost:3000. If that does not work, you have other problems. Paste the stack trace then ...
The problem was I forgot that I had two versions of Ruby installed and I had not properly set a default with rvm for some reason. Specifying the default then checking the gems were present for that version of Ruby fixed it.
As an example, I want to download: https://github.com/banker/newsmonger and tinker with it (to learn Rails). I've downloaded the zip and when I go into that folder and type rails server, the terminal window says to create a new rails app
This is a Rails 2 application, and so as ennuikiller said, you'll need to run script/server.
You may run into problems with dependencies not being installed in this application, which is a problem that normally (now) would be solved with Bundler. Due to this being a Rails 2 application, it doesn't support Bundler out of the box and the owner of the repo hasn't updated it to support that, and so you're dead outta luck there.
What you'll need to do is attempt to run rake gems:install (which may or may not work, depending on the sun's positioning) which will install the gems specified in config/environment.rb and the proper config/environments files using the config.gem methodology. This was how it was done in Rails 2, and caused so many problems that Bundler was created.
If that doesn't work, contact that banker guy on GitHub and ask him what the deps are or work out the dependencies yourself.
Good luck!
Depending on the version of rails this app uses you may have to execute the following :
script/server
I'm getting this error with Passenger:
https://github.com/huerlisi/PDFKit.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)
When I run cap deploy (I'm using capistrano), it's saying that it's bundling the gem, so I'm not sure what's wrong.
I'm the huerlisi who's PDFKit branch you're using. I just want to tell you that you should consider switching back to the original branch at https://github.com/jdpace/PDFKit as I'm not maintaining my branch, and the 'always render as PDF' bug has finally being fixed:-)
If you're installing gems from a git source, you will need to install them using bundle install as the error says. The contents of them are usually saved in ~/.bundler and loaded in from there according to the specific version saved in Gemfile.lock.
What could be happening is that your application does not have a valid Gemfile.lock to latch on to and uses system gems by default.
What does bundle check show on your installed app?
It is not uncommon to have gems installed for the wrong version of ruby if you're using something like rvm.