Travis reports odd message of corrupted Gemfile.lock - ruby

Im using bundler to install stuff and since I have added Gemfile.lock, travis started to complain with:
Your Gemfile.lock is corrupt. The following gem is missing from the DEPENDENCIES
section: 'echoe'
Of course, everything works locally. It also works using DeployBot. I even installed docker ubuntu and tried, still ok. My Gemfile.lock is not corrupt. Same versions of ruby and bundler is used.
What is going on?
Update
This is something related to bundler version. Im using 1.11.0, but got reports that it worked with eg. 1.8.3. ??

We've seen a very similar issue today on Buildkite due to the recent release of a new bundler version
https://rubygems.org/gems/bundler/versions/1.11.0
We got the build working by stipulating the version of bundler to install.
gem install -v 1.10.6 bundler --no-rdoc --no-ri
and forcing the use of that
bundle _1.10.6_ install

Firstly, remove the gem lock file:
rm -f Gemfile.lock
Then install the dependencies:
bundle install
You can update the dependencies to ensure that you won't get an error:
bundle update

Related

Bundler 2.2.0 and Ruby 2.7.5 on Docker crashing

I installed Ruby 2.7.5, and within the Dockerfile, specified bundler (version 2.2.0) to be installed:
RUN gem install bundler -v 2.2.0 --no-document
the output of this is:
INFO[0093] RUN gem install bundler -v 2.2.0 --no-document
INFO[0093] cmd: /bin/sh
INFO[0093] args: [-c gem install bundler -v 2.2.0 --no-document]
INFO[0093] Running: [/bin/sh -c gem install bundler -v 2.2.0 --no-document]
Successfully installed bundler-2.2.0
All seemed to be fine in that install, and bundle works as gems specified in Gemfile are installed. However, when I try to open the console, I see this:
/usr/lib/ruby/2.7.0/rubygems.rb:277:in `find_spec_for_exe': Could not find 'bundler' (2.2.0) required by your /app/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.2.0`
However, it is installed. as you can see from above. Also, when I output the version within the Dockerfile, I see:
Bundler version 2.2.0
It seemed to install fine, however, still see the error above, and it crashes immediately.
Is there something obvious I am doing wrong?
Building a Docker Image with an Updated Bundler Version
You're missing a couple of steps in your Dockerfile build for bundled gems. After you update Bundler, you also need to update your Gemfile.lock and possibly re-run bundle install. There are a lot of options involved, but here's my personal recommendation for your Dockerfile based on your post:
# Note: Don't lock your Bundler version unless you
# have a VERY good reason to do so. Update will
# install or update, as needed.
RUN gem update bundler --no-document \
&& gem clean bundler \
&& bundle update --bundler \
&& bundle install
The key here is that if you don't use bundle update --bundler then the Gemfile.lock will not contain the version of Bundler that you're expecting to call. Recent versions of Bundler will downgrade themselves to the version in the Gemfile.lock if necessary, so this is really the key to the whole thing.
In addition, if you continue to have problems after applying the recipe above, you may need to figure out where Bundler is actually being installed inside your container image. While Bundler (currently) doesn't run from inside your bundle, the required version still needs to be in GEM_HOME, GEM_ROOT, or GEM_PATH in order to be found when you invoke it.
As a final consideration, if you're building your gems locally or modifying your Gemfile.lock and then using an ADD or COPY command to place the Gemfile.lock or any vendored gems into your container image, you need to perform these activities outside of Docker rather than inside the Dockerfile. Based on your original post it doesn't look like you're doing that now, but it's another option to consider as you work on resolving this.

Not able to update Bundler version

I have a gemfile.lock which requires Bundle 2.2.19 . My system has Bundle 1.11.2. Now I ran the following commands:
gem update --system
sudo gem install bundler
Has the following output:
Successfully installed bundler-2.2.31.gem
But after that, I do:
Bundler --version
I still get
Bundler version 1.11.2
And if I try to do
bundle install
I get
You must use Bundler 2 or greater with this lock file
I also tried running
bundler update --bundler
But that does not work either. I also tried uninstalling and reinstalling but while uninstalling, it only uninstalls the 2.2.31 version. Also tried something like
bundle _2.2.31_ install
But it says could not find command. Any suggestions are welcome.

An error occurred while installing pg (1.0.0), and Bundler cannot continue

I'm trying to deploy Zipsell with heroku. However when I run through the heroku and ruby setup and try to deploy via:
git clone https://github.com/yongfook/zipsell
cd zipsell
./bin/setup
I get the error message:
An error occurred while installing pg (1.0.0), and Bundler cannot continue.
Make sure that gem install pg -v '1.0.0' --source 'https://rubygems.org/' succeeds before bundling.
In Gemfile:
pg
I have run through the setup process now multiple times and reinstalled all but still am not able to deploy. Any idea what is going wrong?
From the repo you posted it seems the error message is very clear. From the Gemfile of the repo you shared it seems you haven't install pg which is the postgresql (You will need to remove sqlite.
The problem is that there are some missing dependencies that you don't have installed and that why the error is thrown. There is the concepts of gems which is packaged code. https://rubygems.org/ via the following website you can find some of the gems you'r missing. There is also the versions which have to be compatible.
What you'll do is search for the missing gems shown in the error message. Check for the correct version if you the gem in your Gemfile but the version is conflicting.
https://github.com/yongfook/zipsell/blob/master/Gemfile
bundle update
install the missing gems
gem install pg
and so on. Or do it straight in the Gemfile.

Bundle install fails, Gem install succeeds

When trying to bundle install on a Gemfile that contained only the GitHub Pages gem and nothing else, on Ubuntu 18.04, I got error messages telling me to try installing eventmachine using gem install. That always succeeds, but bundle install still fails. How can I get bundler to see that the gem is installed?
I fixed this after many hours of struggle, by noticing that on the GitHub Pages repo there's a note that says
Important: Make sure you have Bundler > v1.14 by running gem update bundler in your terminal before following the next steps.
I have no idea why this mattered but I removed my ruby packages from Ubuntu and reinstalled them, then installed bundler with rubygems, which gave me a newer version:
sudo apt-get remove ruby
sudo apt-get install ruby ruby-dev
sudo gem install bundler
bundler --version
If anyone knows why I needed that version of bundler, or how I should have diagnosed this faster, I'd be interested to hear it. I'm not new to programming but I'm new to Ruby.
From my understanding it might be the gem you are trying to install requires a specific feature provided by bundler. If you check the change log of bundler there is some changes related to install github based gems on how to correctly read the user git settings. So I think that might be where the problem is from.

Cocoapods points to wrong version

I had some problems with one version of the project. I've found this answer where someone suggest steps to remove all cocoapods-connected stuff from the machine and reinstall it. I did follow the steps:
$ 'pod --version'
0.36.1
$ gem list --local | grep cocoapods
cocoapods (0.39.0.rc.1, 0.38.2, 0.38.1, 0.37.2)
cocoapods-core (0.39.0.rc.1, 0.38.2, 0.38.1, 0.37.2)
cocoapods-downloader (0.9.3, 0.9.1)
cocoapods-plugins (0.4.2)
cocoapods-search (0.1.0)
cocoapods-stats (0.6.2, 0.5.3)
cocoapods-trunk (0.6.4, 0.6.1)
cocoapods-try (0.5.1, 0.4.5)
$ gem uninstall cocoapods // and all others from the list above
The problem is that when i again grep all cocoapods, the list was equal to upper one, nothing disappeared.
$ sudo gem uninstall cocoapods
Select gem to uninstall:
1. cocoapods-0.37.2
2. cocoapods-0.38.1
3. cocoapods-0.38.2
4. cocoapods-0.39.0.rc.1
5. All versions
> 5
$ pod --version
// here was the error command not found, so everything fine
$ sudo gem install cocoapods
Fetching: cocoapods-0.38.2.gem (100%)
Successfully installed cocoapods-0.38.2
Parsing documentation for cocoapods-0.38.2
Installing ri documentation for cocoapods-0.38.2
Done installing documentation for cocoapods after 2 seconds
1 gem installed
$ pod --version
Could not find proper version of cocoapods (0.36.1) in any of the sources
Run `bundle install` to install missing gems.
But why does it want me to install 0.36.1? Anyway, as it asked, I did:
$bundle install
Installing cocoapods-core 0.36.1
Installing cocoapods-downloader 0.8.1
Installing cocoapods-plugins 0.4.1
Installing cocoapods-trunk 0.6.0
Installing cocoapods-try 0.4.3
Installing cocoapods 0.36.1
// Many "using" dependencies
So now when I run:
$ pod --version
0.36.1
And I'm stuck :) Why can't I have newest release version? Maybe pod --version points to the newest version of cocoapods-core instead of only cocoapods, so everything is ok and I have the correct version?
Check if you use Gemfile and there is specified the version of
cocoapods.
You can use specific version by pod *version* action. For example: pod _1.5.0.beta.1_ update or pod _1.5.0.beta.1_ install
For anyone coming to this in an attempt to update cocoapods. After doing all of the above I wasn't able to get this resolved. I then headed to the resolved answer and being unwilling to remove RVM, I tried to resolve this issue another way.
I found that my issue did indeed lie in my Gemfile.
First, run
gem install cocoapods to ensure you have the latest version, or whatever specified version you were looking for downloaded.
Second, ensure your projects Gemfile hasn't specified a cocoapods version number and instead simply specifies it as:
gem "cocoapods"
If yours doesn't, change this and run bundle update to regenerate the Gemfile.lock file and your problem should be solved. If not, go ahead and delete the Gemfile.lock file altogether and then run bundle update. You can easily check to see which gem version will be loaded by opening the Gemfile.lock file and searching for cocoapods-core <version number here>
At this point, you can go into your project and run
pod setup
and then check the cocoapods version with
pod --version
and now FINALLY you are free to run
pod install
to replace the Podfile.lock file and get back to your happy dev life. Hope that helps someone and saves them from burning hours.
It seems something got messed up in my ruby version. I still have no idea what and why. I've managed to fix it via this solution: https://stackoverflow.com/a/25021772/849616. After it everything works correctly.
You might face this issue when it comes migrating to a higher Swift version. Assuming that you already have cocoapods installed, you probably need to run bundle update command (possibly with sudo).
For more details, you could check: https://guides.cocoapods.org/using/a-gemfile.html
Additionally, I'd suggest to do the following:
Install the latest Xcode version.
Clear derived data (not just clean project) in your project.
Run pod update command.
I have the same problem.
In my project, pod --version and gem which cocoapods always return diffrence version.
All I had to do is remove Gemfile.lock in my project and bundle install again. It removed the locked cocoapods version and install a new one.
Hope that helps some one here.
I ran pod install and I've got this error:
Could not find proper version of cocoapods (1.11.3) in any of the sources
and I ran:
bundle install
after that pod install worked properly

Resources