Heroku / "fatal: pathspec '.gems' did not match any files" - ruby-on-rails

I am trying to deploy one ROR app on Heroku.
As I typed "git push heroku master", I got this :
-----> Heroku receiving push
-----> Rails app detected
-----> WARNING: Detected Rails is not declared in either .gems or Gemfile
Scheduling the install of Rails 2.3.8.
See http://docs.heroku.com/gems for details on specifying gems.
I wanted to know what it meant especially what was behind the "WARNING" message.
On Heroku's website (http://docs.heroku.com/gems) it's said you can fix this issue with the following instructions :
git add .gems
git commit -a -m "added .gems file specifying framework
git push heroku master
The problem is when i type "git add .gems", I get this :
fatal: pathspec '.gems' did not match any files
What do you think i should do ?
Thanks in advance for your time.
Have been learning Ubuntu, Heroku+ROR for a few days
OS : Ubuntu
Ruby : 1.8.7
Rails : 2.3.8

You have to create the .gems file first, if it doesn't exist already:
$ touch .gems
$ git add .gems
$ git commit

Related

RoR: Rake failing - "Not a git repository : .git" & "Could not find activesupport-4.2.3 in any of the sources"

UPDATE 2: This gem is definitely causing the git errors as well. In the gemspec files it has git commands which when I commented out, got rid of the git errors.
UPDATE 1: So after uninstalling ruby and all gems and going back through and reinstalling I found the source of at least one of the issues. The devise-neo4j gemfile.lock requires version 4.2.3 of activesupport and all other rails gems. Currently looking to see if there's a fix. Not sure if that is also causing the weird git errors but they seemed to crop up at the exact same time.
ORIGINAL POST:
When running any rake command I get the following error :
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
Could not find activesupport-4.2.3 in any of the sources
Run `bundle install` to install missing gems.
Which makes no sense because when I run git status I get:
On branch master
nothing to commit, working tree clean
and I also have active support installed so I have no idea whats happening:
C:\Users\mcr43\RubymineProjects\Carbon>bundle show activesupport
D:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-5.0.1
I've tried looking for a solution via other people with similar issues but nothing seems to be working.
Where do run a rake command. in development or in production? In development it should not have anything to do with git. Are you using rails 5+? than you can also try rails db:migrate instead of rake. at least in development. Did you check git remote? did you run git add . and git commit -m "com" correctly? Did you push everything into git? Can you see your app in your git folder online? Try these things and double check.
Have you tried running bundle install?
You have activesupport-5.0.1 installed, but it is looking for activesupport-4.2.3
So after uninstalling ruby and all gems and going back through and reinstalling I found the source of at least one of the issues. The devise-neo4j gemfile.lock requires version 4.2.3 of activesupport and all other rails gems. Currently looking to see if there's a fix. Not sure if that is also causing the weird git errors but they seemed to crop up at the exact same time.
UPDATE: This gem is definitely causing the git errors. In the gemspec files it has git commands which when I commented out, got rid of the git errors.

Cannot find Ruby or Rails in my computer after installing Heroku

I just started to learn Rails from railstutorial.org. After installing Rails I cerated an app, set up git, installed Heroku gem, and uploaded SSH key to heroku.
After that, I turned off my computer and a few hours later I came back to continue with the next steps. First I ran heroku create --stack cedar.
Then,
git push heroku master I get the following error message:
[~ (master)]$ git push heroku master
fatal: 'heroku' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
Same thing is happening for commands like rails heroku gem etc.
Also, I cannot find neither Ruby or Rails in my system. When I ran ruby -v I get
The program 'ruby' can be found in the following packages:
* ruby1.8
* ruby1.9.1
Try: sudo apt-get install <selected package>
Is this happening because I am running Ruby 1.9.3p125? Please help.
just type
rvm gemset list
rvm use 1.9.3#(you_gemset) --default
EDIT: i've looked this tutorial, and there he's created gemset: rails3tutorial2ndEd
then just type: rvm use 1.9.3#rails3tutorial2ndEd --default
You probably haven't set ruby 1.9.3 as your default ruby with rvm. You can do this by typing in the command line:
rvm use 1.9.3 --default
This should solve your problem.

Trouble pushing basic Ruby on Rails app to Heroku

I was working through the first chapter of the Rails Tutorial. I pushed first_app to heroku. At first I was getting the sqlite3 error (I think). But, I edited the gemfile and pushed it up to heroku again. But, I don't get the same page as on: http://railstutorial.org/ruby-on-rails-tutorial-book#sec:1.4.3 (I think it's supposed to look like Figure 1.11 in section 1.4.3)
Instead, I get this: http://blooming-samurai-546.heroku.com/
It just says:
Heroku | Welcome to your new app!
Refer to the documentation if you need help deploying.
I did something wrong right? Any ideas what?
In your git console try:
git add .
git commit -am "Initial commit"
git push heroku
It looks like you pushed to heroku with nothing so it created an empty directory.
I had this same issue and was very frustrated by it. What solved the issue for me was moving
gem 'sqlite3'
into the block following
group :development, :test
in the Gemfile.
After that, no longer saw these kinds of messages:
remote: ! Failed to install gems via Bundler.
remote: ! Detected sqlite3 gem which is not supported on Heroku:
...
remote: ! Push rejected, failed to compile Ruby app.
in terminal after typing git push heroku or git push heroku master
Hope this helps.
Can’t argue with success.
However, before pushing the master with $ git push heroku master some folks may need to run the following command:
$ git remote add heroku git#heroku.com:your-heroku-url-goes-here.git
as discussed in the “Git Remotes and Heroku” section currently at:
http://devcenter.heroku.com/articles/git

Rails vendor plugin failure in production environment

I expect this to be a n00b problem.
I'm attempting to use heroku with my rails app. Everything works fine in development (local machine), but when I push to heroku I get the following:
==> dyno-1931938.log (crash) <==
/home/slugs/258915_4fd8878_0dbe-1413ed77-735c-469d-924e-619b28cdcbac/mnt/.bundle/gems/ruby/1.8/gems/activerecord-3.0.0/lib/active_record/base.rb:1016:in `method_missing': undefined local variable or method `acts_as_paranoid' for #<Class:0x2b469869b658> (NameError)
from /disk1/home/slugs/258915_4fd8878_0dbe-1413ed77-735c-469d-924e-619b28cdcbac/mnt/app/models/my_model.rb:17
lines 16 and 17 of my_model.rb are:
class Contact < ActiveRecord::Base
acts_as_paranoid
'acts_as_paranoid' is a vendor plugin that was installed locally via:
$git clone https://github.com/goncalossilva/rails3_acts_as_paranoid.git
What am I doing wrong that heroku is ignoring the plugin?
UPDATE:
I cloned the repo from heroku, and the directory for the plugin exists, but is empty. My other plugins (i.e. ssl_requirement) have the expect lib/ and init.rb. Obviously the code needs to be there to work. What now?
Cloning the source retrieves the code from github, but it doesn't install the gem into your app. Normally you'd install the gem on your local machine like this:
gem install acts_as_paranoid
or
sudo gem install acts_as_paranoid
Then tell Heroku about the gem by adding this to your .gems file:
acts_as_paranoid
or better yet, specify the version that you expect, too (otherwise Heroku will grab the latest every time you push up new code to your app, which could cause unexpected breakage):
acts_as_paranoid --version x.y.z
And make sure your config/environment.rb has an entry for the gem so its absence will be detected at launch instead of later:
config.gem 'acts_as_paranoid', :version => 'x.y.z'
PS: All of the above will be somewhat different if you're using Rails 3 and/or Bundler to manage your gems.
It turns out vendor/plugins/my_plugin_directory had fallen out of the git tree. I resolved the problem by:
$cd rails_root_directory
$git fsck
$git rm --cached vendor/plugins/my_plugin_directory
$git add vendor/plugins/my_plugin_directory/*
$git commit -am "my_plugin added to repository"
$git push heroku master
and all is right now.

push rails app to heroku

I am trying to push a rails application to heroku.
When I get to the last step:
git push heroku master
It doesn't work and gives me these errors:
Counting objects: 85, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (74/74), done.
Writing objects: 100% (85/85), 24.38 KiB, done.
Total 85 (delta 23), reused 0 (delta 0)
-----> Heroku receiving push
! Heroku push rejected, no Rails or Rack app detected.
error: hooks/pre-receive exited with error code 1
To git#heroku.com:smooth-dusk-26.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:smooth-dusk-26.git'
I don't know what I'm doing wrong :(
Here's the answer I got from Heroku and it worked for me (after trying different pg gems, adapters, and everything else on the 10 other posts about this)
1) add the line:
gem 'pg'
to your Gemfile.
2) Run the command bundle install to install the gem into your bundle.
3) Stage the Gemfile and Gemfile.lock changes:
git add Gemfile Gemfile.lock
4) Commit the changes:
git commit -m "Install the pg gem"
5) Redeploy to heroku:
git push heroku master
When you created your Rails application, did you change directory into the directory of the application? You have to perform all the commands from within the application's directory.
rails myapp
cd myapp
I encountered the same errors working through Chapter 1 of Michael Hartl's Rails Tutorial. They were eventually resolved by issuing another git commit command after opening a Heroku account and configuring the SSH keys: git commit -a -m "Heroku recommit"
git push heroku master then succeeded.
I just had the same problem trying to push my app to heroku and none of the above answers fixed it.
I solved the issue by emptying my RVM Gemset with rvm gemset empty, deleting my Gemfile.lock (probably best to just rename it) and reinstalling my gems. Pushing worked fine after this.
For me it was the presence of index.php that fixed it. Heroku seems to check for existence of index.php on pre-commit.
Got the same problem under windows following one of the guides on ror site. After making everything like here http://devcenter.heroku.com/articles/quickstart it was solved.
Seems like problem was because of missing two lines.
cd myapp
git init
Also, if you're on Rails 3.0 make sure you use the cedar stack
heroku create --stack cedar
I went through the Rails Tutorial and didn't have a single problem with Heroku (MAC OS X), but you do have to follow the directions.
First, make sure you add/commit to Git. Then if you're in a -b (branch) you need to checkout into master, then merge the branch. If you've made changes to assets, you need to rake asset:precompile.
If you're having a rack up issue, make sure you have this file => config.ru and the contents should look like this.
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run SampleApp::Application
I'm relatively new to Rails and Heroku, but as I mentioned above, if you're following the tutorial's directions, Heroku is a snap and the directions most definitely work. If not, I highly recommend getting started there!
enter link description here

Resources