Whenever gem in rails error :'to_specs': Could not find bundler (>= 0) amongst - rake

I am using whenever gem in my application. And i have scheduled a rake task every 5 minutes. But that rake task is not running every 5 minutes. When i saw the log it gave me error like
`to_specs': Could not find bundler (>= 0) amongst [bigdecimal-1.1.0,
io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4]
(Gem::LoadError)
this is the content in schedule.rb
every 3.minutes do
rake "mytask name"
end

I had same issue solved by putting
env :PATH, '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin'
instead of
env :PATH, ENV['PATH']
on the top of config/schedule.rb

This issue occurs whenever we changes in your gem file, specially rails / ruby version.
I was facing this same issue, here is what I did to get rid of that-
1. $ gem install bundle
2. $ bundle install
Now everything working fine.
If you are getting same issue as-
`to_specs': Could not find 'railties' (>= 0) among 23 total gem(s) (Gem::LoadError)
then here are the steps-
See the link as-
Rails: Could not find railties
1. $ gem list
2. $ gem install rails
It will just download all missing dependencies, including railties.
Hope this will work for you too !!!

Related

Fastlane "nokogiri requires Ruby version >= 2.3.0." Error

I finished this tutorial on Medium in order to integrate my Xcode project with SonarQube to have some metrics. Setup SonarQube - Swift. I was able to make it through the last step that is: running fastlane metrics on the terminal while being in the root of the project directory. But I get this error on step "slather".
nokogiri requires Ruby version >= 2.3.0., fastlane finished with errors:
I have also found that someone had a similar question here, but no answers:
Similar Question
If I run:
nicolas$ ruby --version
I get ruby version 2.6.3, which is higher than the required 2.3
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
Does anyone knows how to fix this, or got any hunches? Thanks in advance, I appreciate any help.
After digging around and trying several solutions, I finally solved this. What happened was that I initially installed Fastlane with this command:
brew cask install Fastlane
And it seems that it was using another version of ruby while I had a newer one. So I uninstalled it with:
brew cask uninstall Fastlane
And then I re-installed it with this command:
sudo gem install -n /usr/local/bin fastlane -NV
Because I was having problems with permissions and then all worked good.
References and other solutions:
Github thread
usr/local/bin

Jekyll site deployment to Netlify - Error gem bundle install (use Bundler 2 or >) / Failing build

I'm using Cloud9 and GitHub (Private Repos). I've been able to deploy basic landing pages to Netlify but I keep getting the same error message when I try to deploy any Jekyll sites. Snippet from deployment log:
> Installing gem bundle
> You must use Bundler 2 or greater with this lockfile.
> Error during gem install
> failed during stage 'building site': Build script returned non-zero exit code: 1
> Error running command: Build script returned non-zero exit code: 1
> Failing build: Failed to build site
After many many failed attempts, I created a new test dev environment. Per Jekyll docs I made sure I had the latest Ruby, RubyGems, gcc, g++, make & dependencies. Did the usual config, then Jekyll new test_directory. Steps:
> gem install jekyll bundler
> gem install bundle
> gem update --system
> cd new_directory && bundle install
> ~/new_directory/ bundle update
> ~/new_directory/ bundle exec jekyll serve
*** Works perfectly on localhost ***
At this point everything looks fine (jekyll 3.8.5 - gem 3.0.2 - ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux])
Important:
> bundler -v
returns
> Bundler version 2.0.1
After I push to completely new repo, I get the same error message as above:
"use Bundler 2 or greater with this lockfile"
Snippet from lockfile:
> DEPENDENCIES
> -jekyll (~> 3.8.5)
> -jekyll-feed (~> 0.6)
> -minima (~> 2.0)
> -tzinfo-data
> RUBY VERSION
> ruby 2.5.1p57
> BUNDLED WITH
> 2.0.1
I also added this to _config.yml file:
> url: "https://infallible-hodgkin-e15692.netlify.com/"
And per Netlify docs I added a /.ruby-version file inside my root directory with this line:
> ruby 2.5.1
After updating everything and git push, it still fails to build my site but this time I get a couple new lines on the deploy log:
>** WARNING **
> Using custom ruby version ruby 2.5.1, this will slow down the build.
> To ensure fast builds, set the RUBY_VERSION environment variable, or .ruby-version file, to an included ruby version.
> Included versions: 2.3.6 2.4.3 2.2.9
Needless to say I tried switching to each "Included" Ruby -v (rvm use ..*). Went through the process of installing each version and repeated steps above each time. No luck.
Any suggestions as to what to try next are greatly appreciated. Sorry for the long post, I tried being as concise as possible. Please let me know if I missed anything.
So the problem was I should've been using Bundle 1 instead of Bundle 2 plus ruby 2.3.6. Make sure you're on bundle version 1. You can read a little more here:
https://bundler.io/guides/bundler_2_upgrade.html
switch to ruby 2.3.6:
> rvm use 2.3.6 (it'll give you the prompt to install it)
run this command on your project's root directory check if it worked by running bundle version
> gem install bundler -v "~>1.0"
then
> gem install jekyll
> gem install bundle
Here's what I changed on mi Gemfile.lock:
> RUBY VERSION
> ruby 2.3.6p384
> BUNDLED WITH
> 1.17.3
My Gemfile just says ruby "2.3.6" at the top and I also change the /.ruby-version file to ruby 2.3.6 (no quotes). And that's it. Don't forget to bundle exec jekyll serve, commit and push and it should be fine.

Installing redmine_contacts plugin for bitnami_redmine

I am trying to install redmine_contacts plugin for my redmine 2.2.3.0 (which is installed using BITNami installer), as in readme.rdoc:
Copy redmine_contacts plugin to {RAILS_APP}/plugins on your redmine path
Run bundle install --without development test RAILS_ENV=production
Run rake redmine:plugins NAME=redmine_contacts RAILS_ENV=production
The first two steps was successful, but last executing last command, following error would occur:
(in /home/.../redmine-2.2.3-0/apps/redmine/htdocs)
Could not find sprockets-2.2.1 in any of the sources
Run bundle install to install missing gems.
To see if the sprockets library is installed by executing command: #bundle show sprockets, it shows a newer version of this library is installed:
/var/lib/gems/1.8/gems/sprockets-2.2.2
I think somehow the BitNami version of gem which is installed is not compatible with the sprockets-2.2.2 on the system and it requires 2.2.1. Maybe you should change to that version.
Try something like:
gem install sprockets -v 2.2.1

Why can't TeamCity run this Rake build using Albacore?

I created a build script using Rake & Albacore which builds a solution and executes unit tests. I am trying to set it up in TeamCity. I am getting this error.
Cannot start build runner: If you wan't to use bundler please install
it at first. The gem wasn't found in Gem paths of Ruby SDK with
interpreter: 'C:\Ruby187\bin/ruby.exe'.
Hide stacktrace
jetbrains.buildServer.agent.rakerunner.RakeTasksBuildService$MyBuildFailureException:
If you wan't to use bundler please install it at first. The gem wasn't
found in Gem paths of Ruby SDK with interpreter:
'C:\Ruby187\bin/ruby.exe'. Gem paths: C:/Ruby187/lib/ruby/gems/1.8
C:/Users/af/.gem/ruby/1.8
I added one parameter, where Albacore is installed. But, I am still getting the error.
GEM_PATH=C:\Ruby187\lib\ruby\gems\1.8\gems\albacore-0.3.4\albacore.gemspec
Ok finally was able to resolve the problem. I simply created a batch file that executes the rake task and instead of using "Rake Build Step" in Team city; used the command line build step and executed the batch file. It also gives me complete log of all the build steps, tests run etc.
Hopefully this will help someone else too. You don't need to setup a Rake Build Step as it turns out.
It's not clear that Albacore was missing. The error message indicates that TeamCity cannot find Rake itself!
Cannot start build runner
What was the exact Rake task configuration? Specifically the Ruby Interpreter configuration section? You can tell TeamCity exactly which Ruby to run, which will affect which gems are available (and Rake is just a gem).
It looks like you have a Ruby 1.8.7 installed and that you must have installed Albacore
cmd> gem install albacore
Do you also have Rake installed? In Ruby 1.8.7, the Rake gem was not included by default. You can list the machine's installed gems by
cmd> gem list --local
You'll should install Rake.
cmd> gem install rake
I'm not actually sure how you ended up getting this to work. What's the contents of the batch file? Do you have any other Ruby/Rake installed?

Rails 3.1 - Pushing to Heroku - Errors installing postgres adapter?

I just upgraded to Rails 3.1 and the first app i've tried to deploy to Heroku has encountered a problem relating to Postgres adapter. I'm able to push the app to heroku but then when i try to migrate the database i get the following error:
heroku rake db:migrate
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter`
(pg is not part of the bundle. Add it to Gemfile.)
Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)
when I try their suggested install i get:
ERROR: Could not find a valid gem 'activerecord-postgresql-adapter' (>= 0) in any repository
ERROR: Possible alternatives: activerecord-postgis-adapter, activerecord-jdbcpostgresql-adapter, activerecord-postgresql-cursors, activerecord-jdbcmysql-adapter, activerecord-jdbcmssql-adapter
which already seems weird... so what exact gem should I install to get this thing working if not what they say I should install??
When I try installing gem pg i get:
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/jerometufte/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
...
I'm using SQLite3 currently. Any help greatly appreciated, this is baffling me.
Option 1:
Add pg to your Gemfile but skip trying to install it locally.
$ cat Gemfile
...
group :production do
# gems specifically for Heroku go here
gem "pg"
end
# Skip attempting to install the pg gem
$ bundle install --without production
Option 2 (Debian/Ubuntu):
Add pg to your Gemfile but first install the prerequisites.
$ cat Gemfile
...
group :production do
# gems specifically for Heroku go here
gem "pg"
end
# Install the pg gem's dependencies first
$ sudo apt-get install libpq-dev
# Then install the pg gem along with all the other gems
$ bundle install
You definitely need pg in the Gemfile for Heroku.
About the error you're getting locally: make sure you have postgres installed, run gem install pq -- --with-pg-config=[path to wherever your pg-config binary is], then bundle install.
Alternatively, if your local database is working fine (either because you're using sqlite or postgres-pr), you could put the gem 'pg' line in your Gemfile in a group called production, then bundle install --without production locally.
More up-to-date info: It had something to do with a different version of pg gem locally.
I already had pg in a production group (I run sqllite locally), but Heroku was still puking.
The problem went away for my new Rails 3.1 app when I:
rm Gemfile.lock
touch Gemfile
bundle install
git add .
git commit -am "wiped Gemfile.lock re-ran bundle install"
git push heroku master
worked like a charm when I then ran heroku run rake db:migrate