可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I'm working in rails 3.2 and I receive an error when I try to push to heroku:
git push heroku master Counting objects: 496, done. Delta compression using up to 8 threads. Compressing objects: 100% (435/435), done. Writing objects: 100% (496/496), 5.17 MiB | 249 KiB/s, done. Total 496 (delta 125), reused 216 (delta 8) -----> Heroku receiving push -----> Removing .DS_Store files ! Heroku push rejected, no Cedar-supported app detected To git@heroku.com:lumeo.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'git@heroku.com:lumeo.git'
I have tried the few methods recommended on this forum, including emptying and reinstalling the Gems and deleting and adding the remote, to no avail.
any suggestions?
回答1:
Make sure that your Rails app is in the root of the repo, the Gemfile is present and properly named. It is basically not able to detect your code base as one of the supported project types and hence failing it. Also, even if you do have a proper project, make sure it is part of the repository and you have committed it fine (git status
will help you here and a ls
should help you verify the project structure).
回答2:
If you run $ heroku logs
you may get a "hint" to what the problem is. For me, Heroku could not detect what type of app I was creating. It required me to set the buildpack. Since I was creating a Node.js app, I just had to run $ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-nodejs
. You can read more about it here: https://devcenter.heroku.com/articles/buildpacks. No pushing issues after that.
I know this is an old question, but still posting this here incase someone else gets stuck.
回答3:
In Heroku, you may have problems with pushing to the master branch. What you can do is to start a new branch using
git checkout -b tempbranch
and then push using
git push heroku tempbranch
回答4:
You might also want to check for Heroku telling you there's a typo in your CSS file.
Read through the long boring messages in the terminal closely after you push. There may be something like this: Invalid CSS after
. It means Heroku has found a typo and you need to fix it in the CSS file.
You can do a find for rake aborted!
and directly after that it should say why the push failed.
回答5:
If you get this error and the terminal is not descriptive enough to help you, Heroku might be able to tell you what is wrong through their website. Try the following:
- log in to Heroku and go to your dashboard;
- select the problem application from the list; and,
- check the build logs under the "Activity" tab.
In my case, I had accidentally ignored my Gemfile.lock.
回答6:
The package setuptools/distribute is listed in requirements.txt. Please remove the same.
回答7:
For completeness, the issue may be heroku itself. In rare cases like these https://status.heroku.com would show something along the lines of:
Update
The Heroku Dashboard and Elements have been restored. We are still working to restore the other affected services.
The services still affected are:
- Builds
- Review apps
- Pipelines
- Github deploys
- Heroku CI
- Heroku Buttons
I was able to deploy about 40 minutes later after heroku reported:
All affected services have been restored and are now working as expected. We will be monitoring to ensure there are no further issues.
回答8:
I was getting the same error, and running the following code in the command line solved it:
$ heroku config:set BUNDLE_WITHOUT="development:test"
回答9:
I got the same error when I ran git status :
$ git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working directory clean
To fix it I can run:
$ git push and run $ git push heroku master
回答10:
In my case I had forgotten to use postgres in my production environment. I moved the sqlite3 gem into my development
and test
groups in my Gemfile
. Everything worked after that.
回答11:
Check the following
- Make sure you add all the files and directories needed to be tracked are added using git status [You have done this]
$ git status
- If not added then add them using **git add . ** [You have done this]
$ git add .
- Bundle all gems and you will have Gemfile.lock
$ bundle install
$ git add Gemfile.lock
$ git commit -am "Added Gemfile.lock"
- Push it to heroku
$ git push heroku master
Your push should work
回答12:
I got the same error and looked into activity. Where I found that I had two package lock files which was causing the error.