I am working through chapter 1 of Hartl's Rails 4.0 tutorial, and I'm stuck on Section 1.4.2, which is to push a black app into GitHub and Heroku.
I tried typing git push heroku master, but I get an error message, similar to a previous question on StackOverFlow:
Heroku push rejected - Hartl's Rails 3.2 tutorial
Heroku push rejected, railties dependency conflict? Ruby on Rails Tutorial Section 1.4.2
It's probably the same but I don't even realize it:
-----> Ruby/Rails app detected
-----> Installing dependencies using
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
/usr/bin/env: ruby1.9.1: No such file or directory
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/Rails app
Here is the Gemfile I used:
source 'https://rubygems.org'
ruby '1.9.3'
gem 'rails', '4.0.0.rc1'
group :development do
gem 'sqlite3', '1.3.7'
end
gem 'sass-rails', '4.0.0.rc1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.0'
gem 'jquery-rails', '2.2.1'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
end
UPDATE: The main error seems to be /usr/bin/env: ruby1.9.1: No such file or directory Is that folder on the Heroku machine or my home computer ?
I tried removing the line ruby '1.9.3' from my .gitignore but it still returns this message.
First, Remove ruby 1.9.3 from the Gemfile. You don't need it and may be the cause of your problem. Start of your Gemfile should look like this:
source 'https://rubygems.org'
gem 'rails', '4.0.0.rc1'
group :development do
gem 'sqlite3', '1.3.7'
end
etc........
Also, make sure you run
bundle install --without production
since you are using sqlite3 in :development and postgresql in :production
I had a similar problem. The issue is that Bundler is generating stubs. Rails 4 apps do not store stubs in the app's bin/ directory. In order to fix this problem you need to use the following commands:
$ bundle config --delete bin
Then you need to update the bin directory to use the new Rails 4 executables
$ rake rails:update:bin
Then add the new bin/ directory to your version control using:
$ git add bin
Commit the changes and push your code to Heroku
i had the same problem and the problem was that i didn't chose the version of ruby that i want to use, so i did the following:
$rvm list
ruby-1.9.3-p392 [ i686 ]
ruby-2.0.0-p247 [ i686 ]
$rvm use ruby-1.9.3-p392
$rvm list
=> ruby-1.9.3-p392 [ i686 ]
ruby-2.0.0-p247 [ i686 ]
Related
i try to deploy my rails app to heroku, but when git push heroku master i get error like this :
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
New app detected loading default bundler cache
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:
* pg
* carrierwave
* debugger
* rails_12factor
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:
* pg
* carrierwave
* debugger
* rails_12factor
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby app
why i get error like this? i already to try bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment and run git push heroku master again but i still get same error like before???
i'm using ruby 2.0 and rails 4, please tell me if i'm wrong? thanks before
Edit:
my gemfile:
source 'rubygems.org';
gem 'rails', '4.0.1'
group :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
gem 'sdoc', require: false
end
gem 'devise'
gem "twitter-bootstrap-rails"
gem 'carrierwave'
gem 'debugger',
group: [:development, :test] gem 'rails_12factor'
You can simply delete Gemfile.lock file then commit and push to heroku again.
Before this question gets closed as duplicate let me first say that I have tried multiple solutions presented in questions of similar nature. I am working through the Ruby on Rails 4.0 Tutorial and I have gotten as far as pushing my code to Heroku. However, whenever I run the following:
$ git push heroku master
I get the following:
Counting objects: 74, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (63/63), done.
Writing objects: 100% (74/74), 15.59 KiB, done.
Total 74 (delta 11), reused 0 (delta 0)
-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
/usr/bin/env: ruby1.9.1: No such file or directory
Bundler Output: /usr/bin/env: ruby1.9.1: No such file or directory
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby/Rails app
To git#heroku.com:example.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:example.git'
I have tried several things including changing my Gemfile (see below)
Gemfile :
source 'https://rubygems.org'
ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use sqlite3 as the database for Active Record
group :development do
gem 'sqlite3'
end
# Use SCSS for stylesheets
gem 'sass-rails', '4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '2.1.1'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails', '2.2.1'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks', '1.1.1'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '1.0.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
end
gem 'rails_12factor', group: :production
and editing the configuration variables
$ heroku config:set GEM_PATH = vendor/bundle/ruby/1.9.1
$ heroku config:set PATH = bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
I have also tried running bundle from Heroku using
$ heroku run "bundle update"
However I get this error
bash: bundle: command not found
I have also checked my logs but those are only good for post deployment problems.
Does anyone know how to fix this problem?
Perhaps there is a missing file or directory on the Heroku side of things.
It appears that in order to solve this problem you need to turn off Bundler's stub generator, because Rails 4 apps do not store stubs in the app's bin/ directory. In order to do this use the following commands:
$ bundle config --delete bin
Then you need to update the bin directory to use the new Rails 4 executables
$ rake rails:update:bin
Then add the new bin/ directory to your version control using:
$ git add bin
Commit the changes and push your code to Heroku
i'm new to Ruby on Rails, app is running on local machine
local bundle works
however when i try to git push heroku master, this is the error i get:
remote:
remote: -----> Ruby/Rails app detected
remote: -----> Using Ruby version: ruby-1.9.3
remote: -----> Installing dependencies using
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
remote: /usr/bin/env: ruby1.9.1: No such file or directory
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Heroku push rejected, failed to compile Ruby/rails app
remote:
my gemfile:
source 'http://rubygems.org'
ruby '1.9.3'
gem 'rails', '4.0.0.beta1'
group :development, :test do
gem 'sqlite3'
gem 'rspec-rails'
end
group :assets do
gem 'sass-rails', '~> 4.0.0.beta1'
gem 'coffee-rails', '~> 4.0.0.beta1'
gem 'therubyracer', platforms: :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.0.1'
group :test do
gem 'capybara'
end
group :production do
gem 'pg'
end
what am i missing? thanks in advance!
I had a similar problem. The issue is that Bundler is generating stubs. Rails 4 apps do not store stubs in the app's bin/ directory. In order to fix this problem you need to use the following commands:
$ bundle config --delete bin
Then you need to update the bin directory to use the new Rails 4 executables
$ rake rails:update:bin
Then add the new bin/ directory to your version control using:
$ git add bin
Commit the changes and push your code to Heroku
the issue is with your ruby PATH. so first see what happens when you run
$ heroku run "ruby -v"
Running `ruby -v` attached to terminal... up, run.8734
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
Do you get similar output? If not, then check your path.
$ heroku config -s | grep PATH
GEM_PATH=vendor/bundle/ruby/1.9.1
PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
notice, how bin is in the path. in case its missing from yours, you can manually set PATH and add the bin by following command.
$ heroku config:set PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
I'm trying to push an Enki gem blog to Heroku and I'm getting an error
Could not find jquery-rails-2.0.0 in any of the sources
However, in the Gemfile I had
`gem 'jquery-rails'`
and I've never had a problem pushing an Enki blog with this setup before. Here's the full error message
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
Fetching gem metadata from https://rubygems.org/.......
Could not find jquery-rails-2.0.0 in any of the sources
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
After I got the error message I added this to the gemfile
gem 'jquery-rails-2.0.0'
I got this error message
Could not find gem 'jquery-rails-2.0.0 (>= 0) java' in the gems available on this machine.
I then tried to do
gem install jquery-rails
It gave me
Successfully installed jquery-rails-2.0.2
1 gem installed
Installing ri documentation for jquery-rails-2.0.2...
Installing RDoc documentation for jquery-rails-2.0.2...
But the push didn't work, same error
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.2.0.rc
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
Fetching gem metadata from https://rubygems.org/.......
Could not find jquery-rails-2.0.0 in any of the sources
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
this is the gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.6'
gem 'heroku'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
group :production do
gem 'thin'
end
platforms :jruby do
gem 'activerecord-jdbcsqlite3-adapter'
gem 'trinidad'
gem 'jruby-openssl'
end
gem 'jquery-rails'
#gem 'jquery-rails-2.0.0'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug'
# Bundle the extra gems:
gem 'RedCloth', '~> 4.2.9', :require => 'redcloth'
gem 'ruby-openid', :require => 'openid'
gem 'rack-openid', :require => 'rack/openid'
gem 'aaronh-chronic', :require => 'chronic' # Fixes for 1.9.2
gem 'coderay'
gem 'lesstile'
gem 'formtastic'
gem 'will_paginate', '~> 3.0.2'
gem 'exception_notification', '~> 2.5.2'
gem 'open_id_authentication'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
group :test do
gem 'database_cleaner'
gem 'cucumber-rails', :require => false
gem 'cucumber-websteps', :require => false
gem 'factory_girl'
gem 'rspec'
gem 'nokogiri', '~> 1.5.0'
gem 'webrat'
end
group :development, :test do
gem 'rspec-rails'
end
I was getting this same error and fixed it using:
bundle update jquery-rails
In looking into it, it appears that jquery-rails 2.0.0 was yanked from rubygems: http://d.pr/i/cLms/1ReBI4U8 for whatever reason. So you (and I) likely happened to install jquery-rails when that gem was the most current version.
It's also wise to note that deleting your Gemfile.lock can be dangerous and not recommended in most cases. This causes all the latest versions of every gem without a version number in your Gemfile to be downloaded. If gems have been updated with API-breaking changes (happens more often than you might think), your app could break. But it also might not. Just be careful, run test cases if you have them. This has caused me more than one headache.
You can read a bit more about how bundler, Gemfile, and Gemfile.lock work (as well as guidance on how to properly upgrade certain gems) here: http://viget.com/extend/bundler-best-practices
Worked for me:
delete the Gemfile.lock
removed the rails version from the line => gem 'rails' (jquery was already without a v number)
run the command "bundle install"
run also "bundle update jquery-rails" to make sure everything is updated
IMPORTANT, commit the new .lock file => run the "git add ." and "git commit ..."
push everything
Update:
I am going through mhartl's Rails Tutorials and had to update jquery-rails, '2.0.1' in the Gemfile, to get the bundle update jquery-rails going.
Thanks,
Jatin
i had similar issue by changing in Gemfile jquery-rails-2.0.0 to 2.0.1 will solved my problem.
Michael,
I had to remove the version number from my jquery gem from 2.0.0 and let it pull the latest for this to work. I am on rails 3.2.8.rc2 and running on the cedar stack of heroku. Best of luck!
Mark
I have several gems including ruby-debug in a bundler group called :development. When I run the bundle command, these gems are ignored and it only installs the gems that are not in any group. How can I make sure bundler doesn't ignore the gems in the :development group?
Edit: This is what my Gemfile looks like.
source 'http://rubygems.org'
gem 'rails', '3.0.1'
# Auth gems
gem "devise", "1.1.3"
gem "omniauth"
# Bundle Mongoid gems
gem "mongoid", "2.0.0.beta.19"
gem "bson_ext"
# Asset gems
gem 'jquery-rails'
gem "jammit"
# Controller gems
gem 'inherited_resources', '1.1.2'
# View gems
gem 'haml'
gem 'formtastic', '~> 1.1.0'
# Nokogiri
gem "mechanize"
gem "json"
group :development do
gem "ruby-debug"
gem 'compass'
gem 'compass-colors'
gem 'pickler'
gem 'haml-rails'
gem 'rails3-generators'
gem "hpricot"
gem "ruby_parser"
gem 'fog'
end
Within a term session, it remembers the without option. If you first ran
bundle install --without development
it remembers that you did this and will automatically repeat this for the next
bundle install #remembers and includes --without development
running something else, like bundle install --without nothing should clear the cache. Am I right?
update 20150214: This is fixed in bundler 2.0, according to issue referenced in comment by #Stan Bondi (https://github.com/bundler/bundler/issues/2862). Thanks Stan.
If you are using rails, there will be a file config written into a hidden dir called .bundle in your rails root directory:
.bundle/config
This file, in my case, held exactly the without settings.
So I just deleted the .bundle directory:
rm .bundle -r
After that:
bundle install worked again as expected.
Using: bundler (1.5.2)
I had the same issue and --with flag worked for me. You need to pass group name, which you want to include. Like that:
bundle install --with development
gem 'aws-s3'
gem 'paperclip'
group :test do
gem 'rspec'
gem 'waitr'
gem 'faker'
end
gem 'rest-client', :group => :development
gem 'cucuber-rails', :groups => [:development,:test] (cucuber-rails gems comes under both group)
bundle install --without development #(ignore development group gems)
bundle install #(still bundle remembers --without development so result is still ignore development groups it will not install all gems)
bundle install --without nothing #(just clearing cache, now all the gems to be loaded into the ruby loadpath)
More
In fact Rails loads the :development group automatically when in development environment. Check whether Rails.env in you App really returns "development".
More Information about groups in Bundler:
http://gembundler.com/groups.html
I had a similar problem - thin in staging ignored - and the solution was to put it out if staging into the 'global' space:
gem 'thin'
group :production do
gem 'puma'
end
I've faced the same issue with bundler 2.1.4 When I checked my .bundle/config it has
---
BUNDLE_PATH: "vendor/bundle"
BUNDLE_WITHOUT: "development:test:build"
Remove groups from there and add BUNDLE_WITH to your groups.
BUNDLE_WITH: "development"
I've removed the ~/.bundle/config. but there was a file in my project directory. .bundle/config. Local directory files have precedence over the main config files.
If you can't figure out the reason, then you can just create a file in your project directory .bundle/config. and add this content there
BUNDLE_WITH: "development:test:anyGroupYouWant"