bundle install error - ruby-on-rails-3

I'm trying to install this gem: https://github.com/jongilbraith/simple-private-messages with bundle install.
And I'm getting the following error message:
Updating git://github.com/professionalnerd/simple-private-messages.git
Fetching source index for http://rubygems.org/
Could not find gem 'simple-private-messages (>= 0, runtime)' in git://github.com/professionalnerd/simple-private-messages.git (at master).
Source does not contain any versions of 'simple-private-messages (>= 0, runtime)'
entry in Gemfile:
gem "simple-private-messages",:git =>"git://github.com/professionalnerd/simple-private-messages.git"
Any ideas?

As per #bjeanes answer, ideally the Git repository should have a .gemspec file for each gem the Git repository represents.
However, if the repository is only missing the .gemspec file and would otherwise be a valid Git gem source, you can specify a version number in your gem call to have Bundler generate a .gemspec for you:
gem 'simple-private-messages', '0.0.0', :git => 'git://github.com/jongilbraith/simple-private-messages.git'

The git repo needs to have a .gemspec file in it in order to be a valid gem.

Related

Rails can't install gem sqlite

Gem files will remain installed in
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0 for
inspection.
Results logged to
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.0/gem_make.out
An error occurred while installing sqlite3 (1.4.0), and Bundler cannot continue.
Make sure that gem install sqlite3 -v '1.4.0' succeeds before bundling.
I tried to install earlier version on sqlite, not working.
Tried one of the solutions from stackoverflow :
gem 'sqlite3', '~> 1.3.6'
getting this error
ERROR: While executing gem ... (Gem::CommandLineError)
Unknown command sqlite3,
Please help i'm new in Rails , this is my first project in rails.
Add gem 'sqlite3' to Gemfile in the root directory of your rails project. Then run bundle install and it should install sqlite and make it available to use in your rails project.
Specify git and branch for the gem sqlite3 in your Gemfile should fix the problem.
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"
For more info
https://medium.com/#declancronje/installing-and-troubleshooting-ruby-on-rails-sqlite3-windows-10-fix-87c8886d03b
cannot load such file — sqlite3/sqlite3_native (LoadError) Ruby on Rails
Replace gem 'sqlite3' with gem 'sqlite3', '~> 1.3.11' which is in Gemfile in the root directory of your rails project. Then run bundle install.

Issue when pushing to Heroku. Run `bundle install` elsewhere and add the updated Gemfile.lock to version control

I've been trying to trouble shoot this error now for a couple hours without making any progress. I've tried running bundle install in different environments with no luck. I'm not sure what is happening and I feel as if the error is no longer providing relevant feedback. However, I am using Ruby 1.9.3 and when I push it states that Heroku is using ruby 2.0.0. Could this have something to do with it?
Castillos-MacBook-Pro:reservester-nysum13 castillo$ git push heroku master
Identity added: /Users/castillo/.ssh/id_rsa (/Users/castillo/.ssh/id_rsa)
Counting objects: 66, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (51/51), done.
Writing objects: 100% (66/66), 26.25 KiB, done.
Total 66 (delta 4), reused 38 (delta 1)
-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
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.
You have added to the Gemfile:
* debugger
Bundler Output: 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.
You have added to the Gemfile:
* debugger
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby/Rails app
To git#heroku.com:guarded-sierra-5306.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:guarded-sierra-5306.git'
gem 'debugger' originally was placed outside of the environment group. I moved it to the development group and reran bundle.
Here is my Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'therubyracer'
gem 'twitter-bootstrap-rails'
gem 'carrierwave'
gem 'rmagick'
gem "fog", "~> 1.3.1"
gem "devise"
gem "figaro"
gem "galetahub-simple_captcha", :require => "simple_captcha"
group :development do
gem 'annotate'
gem 'sqlite3'
gem 'rspec-rails', '~> 2.0'
gem 'debugger'
end
group :production do
gem 'pg'
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
I got similar error. I tried delete Gemfile.lock file manually, rebundle, push it to git and still no luck.
But finally I make it work by change my rvm version to ruby 2.0.0, precomplie the asset with this command
RAILS_ENV=production bundle exec rake assets:precompile
and delete the Gemfile.lock, rebundle, and push it to github. Last part when you push in to heroku use your branch instead your master, this happen because you not deploying the master branch to heroku master branch with this command:
git push heroku your-branch:master
I had a similar situation. Heroku does not support every ruby version. You may be using an unsupported version.
Check for Heroku Ruby supported versions
Change your local ruby version. For example, if you are using rbenv
rbenv local 2.1.6
bundle install
Push the changes to herokugit push heroku master
You can't expect Heroku to know what version of Ruby you're running locally :-) If you want Heroku to use a particular version, tell it. Add ruby '1.9.3' to your Gemfile for example.
It also looks like you didn't rerun bundle install after putting the gem in development group? Try that.
Then add all the changes to git, commit, and push.
This problem is bacause you commit bad (old) Gemfile.lock to heroku server.
You need to update Gemfile.lock on heroku after adding/removing gems.
Do following steps:
save HEROKU_APP_NAME of existing heroku app ( HEROKU_APP_NAME.herokuapp.com )
remove heroku application from https://dashboard.heroku.com/apps and create new one
rename new heroku app to old HEROKU_APP_NAME
remove Gemfile.lock from your git repo
remove Gemfile.lock form your local project and form .gitignore (if it exist there)
run bundle install
commit changes to git repo ( new created Gemfile.lock )
run git push heroku master

use forked version of a gem - rails 3.020 & ruby 1.9.2

I am trying to use this fork of a gem:
https://github.com/hoyaemt/capistrano-syntax-checking
In my gemfile I have:
gem "capistrano-syntax-checking", :git => "git://github.com/hoyaemt/capistrano-syntax-checking.git"
When I run bundle install, I get:
Could not find gem 'capistrano-syntax-checking (>= 0) ruby' in git://github.com/hoyaemt/capistrano-syntax-checking.git (at master).
Source does not contain any versions of 'capistrano-syntax-checking (>= 0) ruby'
I have read a bunch of postings but nothing I try seems to work here. Any ideas?
thanks
Joel
The original version is missing the gemspec file. It may be missing other things but I was able to get the bundler to run.
Add a gemspec file to the root of your fork. See here for a simple example and just create capistrano-syntax-checking.gemspec file.

Bundler could not find compatible versions for gem

I've added a gem 'koala' to my Gemfile and seems to have thrown gem versions out of whack when I run the 'bundle install' command:
Bundler could not find compatible versions for gem "faraday":
In snapshot (Gemfile.lock):
faraday (0.6.1)
In Gemfile:
koala (~> 1.2.0beta1) depends on
faraday (~> 0.7.4)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
How can I resolve this conflict?
Delete the contents of Gemfile.lock, and run bundle install again. That's been working for me.
Did you run bundle update as the error message points out? bundle install handles changes to the Gemfile and bundle update upgrades gems that are already managed by Bundler. The Gemfile.lock file locks in version numbers, bundle update will update any of those that aren't directly specified in your Gemfile (like gem 'rails', '3.0.9').
Deleting the Gemfile.lock will work, but running bundle update is better.
You can't simply delete you Gemfile.lock if that is a solution then why Gemfile.lock is exist in the first place, you code depend on the versions locked in this file, try to only update the Gem which cause the conflict by using bundle update gem_name and you have to check the ReadMe if any changes needed to work with the new version otherwise you are breaking your code or others code.
I found that by removing the specified version of rails solved the problem for me ....
instead of:
gem rails, '4.0.4'
I did
gem rails
followed by deleting the Gemfile.lock and re-running bundle install
If deleting Gemfile.lock doesn't work there is another possibility:
It may be possible a gem you are depending on has inadvertently included its own Gemfile.lock in its .gem file. The solution is to update the offending gems to not include a Gemfile.lock, rebuild and reinstall.
An alternative is to go to your Gemfile.lock and delete all references to the offending gem (in this case the faraday gem).
Then run bundle install and it'll update the Gemfile.lock to have compatible versions of the gem where it needs.
If you want to be extra safe you can go to the Gemfile and specify the versions of the gems you want before doing this.
This was the only way I was able to get bundle install running for one of the systems that I'm maintaining.
This system has a lot of old gems in its dependencies (58 gems at the time of writing) and so bundler has a hard time coping with it.
If I delete the Gemfile.lock and run bundle install it'll blow up with multiple Bundler could not find compatible versions for gem xxxxxx errors.
If I run bundle update it would also blow up with multiple Bundler could not find compatible versions for gem xxxxxx errors.
Note: Removing Gemfile.lock will have new entried to different gems. This might not be acceptable in your project. Your team or lead will not allow this.
If you are working on legacy codebase, for example Rails 3.2 or similar
In case you hit this kind of errors,
see the last line of Gemfile.lock which seems like
whenever (~> 0.9.4)
wicked_pdf (= 1.1.0)
will_paginate (= 3.1.8)
wkhtmltopdf-binary-edge (~> 0.12.4.0)
BUNDLED WITH
1.16.6
now install the version of bundler mentioned in the file. In my case its1.16.6.
gem install bundler -v 1.16.6
now remove the older version. How?
$ gem uninstall bundler
Select gem to uninstall:
1. bundler-1.16.6
2. bundler-2.1.4
3. All versions
> 2
Successfully uninstalled bundler-2.1.4
$ bundle -v
Bundler version 1.16.6
Now it will install successfully

How to install gem/plugin in rails3 when not found on rubygems?

I want to install the simple-private-messages gem (http://agilewebdevelopment.com/plugins/simple_private_messaging), https://github.com/jongilbraith/simple-private-messages.
I added to my Gemfile:
gem 'simple-private-messages'
But get error:
Fetching source index for http://rubygems.org/
Could not find gem 'simple-private-messages (>= 0)' in any of the gem sources listed in your Gemfile.
I then tried modifying Gemfile to:
gem 'simple-private-messages', :git => 'git://github.com/professionalnerd/simple-private-messages.git'
but get error:
Fetching git://github.com/professionalnerd/simple-private-messages.git
github.com[0: 207.97.227.239]: errno=Operation timed out
fatal: unable to connect a socket (Operation timed out)
Git error: command `git clone 'git://github.com/professionalnerd/simple-private- messages.git' "/Users/homanchou/.rvm/gems/ruby-1.9.2-p180/cache/bundler/git/simple-private-messages-26451211e7d7acc0c1b523bad2621cb2cd38f77e" --bare --no-hardlinks`
1) How else can I install this gem locally?
2) How can I deploy this app to heroku and protect against deployment error if Heroku can not find the gem in any repositories? Do I vendor them into the app?
It doesn't look like that project is a Gem; it's actually a Rails Plugin.
To install, run this in your project folder:
rails plugin install git://github.com/jongilbraith/simple-private-messages.git