I had an app deployed on Heroku and I am currently trying to create the same app on AWS.
I've copied my folder, created a complete separated repo on Github and installed ebcli, the setup looks fine.
When I try to run eb deploy, I have this error:
[Instance: i-03051e2a022886184] Command failed on instance. Return code: 1 Output: (TRUNCATED)...:in find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
from /opt/rubies/ruby-2.5.3/lib/ruby/site_ruby/2.5.0/rubygems.rb:308:inactivate_bin_path'
from /opt/rubies/ruby-2.5.3/bin/bundle:23:in `'.
I've looked online and it says it comes from incompatibility between your gemlock file bundler version and actual bundler version.
I've tried to change my bundler version to this one, but I gave up and came back to 2.0.1 because I had to install too many dependencies otherwise.
I removed the gemlock, bundle again, but I still got the same error when trying to deploy.
With my heroku version, it always worked.
Any idea how to solve that?
Thanks a lot
We moved from Heroku to AWS a few months back as well and it will likely take some some custom scripting to get things to work.
It would help to know more about your EB environment, but I am assuming you are using Ruby 2.5 with Puma on Amazon Linux 2.9.0 (?)
Not sure what bundle version comes with that, But I don’t think it’s 2.x. so you have to add an .ebextensions file too install your preferred bundled version.
# .ebextensions/01_install_bundler.config
container_commands:
install_bundler:
command: “gem install bundler —-version 2.0.0”
More info on AWS Linux customizations
End of the day, we are much happier with our AWS environment (lower cost, better performance), but requires more work to get it set up
Actually the problem exists because the bundler version in the eb env is older than the one being used in the project source.
So the solution is to use a bundler version less or equal the eb env installed version.
First uninstalled the current bundler:
gem uninstall bundle
and then install the desired one:
gem install bundler -v 1.16.6
See more details
I'm trying to initialize a new rails app on windows, and running rails new <appname> generates everything up to vendor/assets/stylesheets/.keep, but when bundle install is run, rails generates this error:
Checksum of /versions does not match the checksum provided by server! Something is wrong.
I'm not sure what's causing this, as I've done nothing to rails itself. Any help is appreciated.
Edit: If it's an error caused by windows being finicky, I have the option of moving to Linux, but I'd like to know what's wrong first.
I had the same issue using windows, and was able to solve it by uninstalling bundler and installing an older version.
rails new <appname>
gem uninstall bundler
gem install bundler -v 1.9
cd <appname>
bundle install
That did it for me!
In my case there was a *.pre.1 version and I chose to uninstall that particular version and then "bundle install" worked.
Try removing your ruby cache folder and then try again. So for example if you are on Linux machine and you are using rbenv and say ruby 2.1.5 folder. Your path would be similar to something like (Not sure where on windows ruby is stored):
~/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/cache/
Removing this folder and trying bundle install again should resolve the issue.
It will be great, if you move to a Linux machine.
On windows it's a hell to pay in my 5 years of experience what i have learned is not to mess with (ror) or (rs) in windows. here's a cheeky thing you can do an easy way. I believe you are using github as repo, as a editor you are using sublime if thats is a case open your gemfile you will see check the image or
try to clear cache on your server or update the gems.
I had this same exact error and solved it the following way. I think you are missing the ruby DevKit being installed.
Go here http://rubyinstaller.org/downloads/ and download/install the latest 32-bit Ruby version (as of writing this 2.2.4, you will need it for the web-console gem)
Make sure to add your ruby\bin folder to your environmental path variable
The trick is hidden near the bottom-left of the same page under the "Development Kit" section. You need to download and extract the right one into a permanent location (as of writing this for 32-bit - DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe)
After extracting the files, go into the main directory and run "ruby dk.rb init" followed by "ruby dk.rb install" (More information can be found here
That fixed it for me and i can now fully install with no checksum issues
This problem began when i tried to run my app. I wrote rails s and the console said me Could not find sdoc-0.4.1 in any of the sources Run bundle install to install missing gems. Then i wrote bundle install and the message that appeared was Checksum of /versions does not match the checksum provided by server! Something is wrong.
I solve this problem following this steps:
Wrote bundle install
The console said me Could not find sdoc-0.4.1 in any of the sources
Then i reinstalled this gem with gem install sdoc -v 0.4.1
I tried again to write rails s and it's was solved.
`
I deleted the gemfile.lock from my Redmine 2.2, installed in my machine. How can I restore it?
I tried "bundle install", without success.
In your case, it's not a big deal.
Gemfile.lock is a snapshot of which version of a gem was installed, where it came from, and it's dependencies, for reasons of portability. Given that you are using packaged software, unless you plan to distribute your code at some point in the future, lacking a Gemfile.lock is not the end of the world.
If you absolutely need a Gemfile.lock file, try changing your Gemfile and running bundle install again. Bundler installs a gem if it cannot find it already cached or installed. Since you are trying to install a fully-installed set of gems, Bundler may be glossing over the entire process without performing any work. Give it something to do by installing an arbitrary gem you don't already have, then maybe it will generate a new Gemfile.lock file for you.
Or I suppose the easiest way is to delete your entire gems folder then run bundle install. This is equivalent to starting over with a clean install, without nuking your data set.
Are you using version control? If you are try git reset --hard. Otherwise, no one can help you...
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.
I'm pretty new to bundler and capistrano, and I'm trying to use them together. When I try to deploy, I get the message:
You are trying to install in deployment mode after changing your Gemfile. Run `bundle install' elsewhere and add the updated Gemfile.lock to version control.
I don't know how to satisfy the system that's complaining, and I don't understand why the complaint is coming up because I read in the doc:
If a Gemfile.lock does exist, and you have updated your Gemfile(5),
bundler will use the dependencies in the Gemfile.lock for all gems
that you did not update, but will re-resolve the dependencies of gems
that you did update. You can find more information about this update
process below under CONSERVATIVE UPDATING.
I interpret that to mean that the Bundler can handle the fact that my Gemfile is not whatever it expected. Any help?
Specs: Ruby 1.9.3, Rails 3.2.3, Capistrano 2.12.0, Bundler 1.1.4, Windows 7, deploying to a Posix machine.
Edit: My Gemfile includes logic blocks like the following:
unless RbConfig::CONFIG['host_os'] === 'mingw32'
# gem 'a' ...
end
The error message you're getting regarding Gemfile.lock may be because your Gemfile and Gemfile.lock don't agree with each other. It sounds like you've changed something in your Gemfile since you last ran bundle install (or update). When you bundle install, it updates your Gemfile.lock with any changes you've made to Gemfile.
Make sure you run bundle install locally, and check-in to source control your newly updated Gemfile.lock after that. Then try deploying.
Edit: As recognised in the comments, a conditional in the Gemfile resulted in a valid Gemfile.lock on one platform, invalid on another. Providing a :platform flag for these platform-dependent gems in the Gemfile should solve the asymmetry.
vi .bundle/config
change the BUNDLE_FROZEN option from '1' to '0'
do "bundle install"
OR
run "bundle config"
see if the "frozen" value is true set it to false
bundle config frozen false
Watch out for global Bundler config.
I had a global config on my dev environment in ~/.bundle/config that I did not have in my CI / Production environment that caused the Gemfile.lock that was generated in my dev environment to be different than the one in my CI / Production environment.
In my case I was setting github.https to true in my dev environment but had no such config in my CI / Production environment. This caused the two Gemfile.lock files to be different.
When you see the following...
$ bundle install
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
If this is a development machine, remove the Gemfile freeze
by running `bundle install --no-deployment`.
You have added to the Gemfile:
* source: rubygems repository https://rubygems.org/
* rails (~> 3.2)
. . .
... Then, the problem is most likely that you have outdated .gem files in your vendor/cache directory.
Perhaps, you previously ran $bundle install --deployment which put some "outdated" .gem files in the cache?
In any case, you can get past this error by running: bundle install --no-deployment
That's one of the many great things about Rails... the error messages often tell you exactly what to do to fix the problem.
My specific problem was related to what reported by #JoshPinter, i.e. dev-vs-deploy host discrepancies in the protocol used by bundler to retrieve gems from github.
To make a long story short, all I had to was modify the following Gemfile entry...
gem 'activeadmin', github: 'activeadmin'
...to this secure syntax (see reference):
gem 'activeadmin', git: 'https://github.com/activeadmin/activeadmin.git'
And my deployments are back to normal.
I don't care. This is what I did. It fixed it.
rm -rf .bundle
rm -rf Gemfile.lock
bundle install
The solution for me was slightly different than the others listed here. I was trying to upgrade from sidekiq to sidekiq-pro (which requires bundler 1.7.12+), but I kept getting the "You are trying to install in deployment mode after changing your Gemfile" message from travis-ci
Inspecting the console output of travis-ci revealed that an older version of bundler was being used.
In my case, I had to edit the travis.yml file to add:
before_install:
- gem update bundler
This forced travis-ci to use the latest version of bundler, and made the error message go away.
rm -fr .bundle
Fixed the problem for me.
Another cause of the error:
This is a bit foolish, but i'm sure someone else will make the same mistake.
For Rails 4 Heroku added the gem rails_12factor. If you were using it before they added it, then you'll have these two gems:
gem 'rails_log_stdout', github: 'heroku/rails_log_stdout'
gem 'rails3_serve_static_assets', github: 'heroku/rails3_serve_static_assets'
You have to remove them when you add the new one. (they're included). I think you can get away with it until you touch them lines in your gem file, then Heroku notices the duplication and cries out with the above error.
good luck with Rails 4.
After this command, you can do your normal bundle install again:
bundle install --no-deployment
I ran into something similar before. One way to fix it, I think, but may take more space on your server than you want, is to run
bundle install --deployment
and then try to deploy. This does something like install all of your gems into the vendor folder, which I believe is generally good to avoid... but will still probably work. My app used to behave like this, my solution was removing exact versions to download from in my Gemfile, and then rebundling and deploying.
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git', :branch => 'master'
to
gem 'rails_admin'
Or you can do what it suggests, and Git your project off the production server onto a local machine, bundle it, and then repush onto your server. This solution might not be 100% correct but some of it worked for me... just thought I'd share. Goodluck
In our case we were using a feature that wasn't available in an old version of bundler which ran on our production machine. Therefore it was enough to upgrade bundler, i.e. do a gem update bundler.
This might be a dangerous idea, but if absolutely must test something in a production deploy environment, you can edit the .bundle/config file
# This value is normally '1'
# Set it to '0'
BUNDLE_FROZEN: '0'
Now invoke bundle, in my case I needed to update a specific gem, so this my command
RAILS_ENV=production bundle update <whatever gem>
You should probably change it back after the update, so things work like you expect, afterwards. Again, this is probably unsupported, and YMMV
This issue can be related to submodules pointing to old versions of code. For me, I resolved this issue by updating my submodules
If you have submodules, try running:
git submodule update --init
bundle install
The error message for the command bundle install in windows 10 (rails v-7) was like
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
If this is a development machine, remove the C:/Users/friends/Gemfile freeze
by running `bundle config unset deployment`.
The dependencies in your gemfile changed
You have added to the Gemfile:
* pg
You have deleted from the Gemfile:
* sqlite3 (~> 1.4)
So I did exactly the error message asked me to do. Ran the following command
bundle config unset deployment
And then I again ran `bundle install and then it worked
I ran into this deploying a Nesta app after some gem updates. What worked for me was to delete the Gemfile.lock, run bundle install to re-generate it, and deploy again.
I ran into a similar issue however I did both bundle install and bundle update and Heroku still rejected my push.
I fixed the issue by just deleting Gemfile.lock and then running bundle install again. I then added, committed, and pushed that to my git repo. After that I had no problem pushing to Heroku.
for heroku, you don't have to change the syntax in the Gemfile. you can just add BUNDLE_GITHUB__HTTPS (note the double underscore) as an environment variable and set it to true (in your heroku app's dashboard under the Settings tab in the Config Vars section). this will switch the protocol from git:// to https:// for all such requests.
I had the error message when attempting push to Heroku. I found the following solution fixed.
Git pull origin master
Git status
Git commit
Git push origin master
Git push heroku master
I read a dozen solutions on different resources but didn't find exactly what could help me in this situation
So I did find a solution. Exactly saying i read the error message attentively and there was a sollution: Run bundle install elsewhere. "Elsewhere" was my Cloud9 where i developed my app. So my steps
copy Gemfile and Gemfile.lock from server to local machine with rsync command
insert these two files into my RoR project (i used Cloud9)
open Gemfile and make changes that i want. In my case i added gem 'thin'
in terminal cd to my app on Cloud9 and run bundle install. in this case you will have a changed version of Gemfile.lock
copy new Gemfile and Gemfile.lock on server using rsync
cd to my app folder and again run bundle install --deployment --without development test
DONE! Wish GOOD luck for all!
As of the time of this writing Bundler support for capistrano defaults to "deployment: true", per
https://github.com/capistrano/bundler
So as opposed to trying to modify the bundle by hand after bundler [via capistrano] has laid it down, you may be able to solve the problem permanently by adding this to your deploy.rb or other Capistrano config file [you can do it just for one stage file as well if necessary]:
set :bundle_config, { deployment: false }
and then deploying again.
You will then notice in the "cap" output the following line [note I am using rvm here but you may not be]
.../rvm ruby-2.7.6#... do bundle config --local deployment false
Why did this stop working all of a sudden?
This is the $1M question, I never had to mess with this, but once I got to an Ubuntu 20.04.05 machine, suddenly, yes. Same cap files, same ruby version, same rails version, same OS version except the minor number.
Did it work?
Did this work for you? Leave me a comment and let me know.