【问题标题】:AngularJS and Ruby on Rails Heroku DeploymentAngularJS 和 Ruby on Rails Heroku 部署
【发布时间】:2016-02-13 18:37:41
【问题描述】:

我使用 Ruby on Rails 和 AngularJS 构建了一个应用程序。它已完成并在我的机器上本地工作。我正在尝试将其推送到 heroku,但我继续收到此错误:

remote: -----> Fetching set buildpack https://github.com/heroku/heroku buildpack
remote:
remote:  !     Push rejected, failed to detect set buildpack https://github.com/
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-fa
remote:
remote: Verifying deploy....
remote:
remote: !       Push rejected to aqueous-temple-93632.
remote:
To https://git.heroku.com/aqueous-temple-93632.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/aqueous-temple-93632.

我查看了不同的教程并尝试了他们的所有建议,但似乎没有任何效果。我的文件结构是:

我在使用heroku create 登录后创建了应用程序,并尝试使用git push <app name> master 进行tp 推送

我读到 Heroku 会自动找到 buildpack,所以我想知道我在 Rails 上使用 angularJS 和 RUby 的事实是否是问题所在,以及是否需要手动添加其他 buildpack。

不确定是否相关,但这里是 gem 文件

source 'http://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
 gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record
group :development do
gem 'sqlite3'
end




#Using postgres SQL as the db
group :production do
gem 'pg'
gem "activerecord-postgresql-adapter"
end

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# 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

#Angular js gem
gem 'angularjs-rails'

#Angular js material designs gem
gem 'rails-angular-material'

gem 'angular-rails-templates'
gem 'bower-rails'

gem "heroku"

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
#gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0',          group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]

【问题讨论】:

  • 我猜你的应用嵌套在一个额外的angApp 目录中。您的 Rails 应用程序需要位于 GIT 存储库的项目根目录中,heroku buildpack 才能工作。
  • 对不起,你能详细说明一下你的意思吗,我是新手。我虽然只需要位于主 angRails 目录中的 .git 文件所在的位置
  • .git 目录需要位于 Rails 应用程序根目录中。这意味着它应该与Gemfile \app 等在同一目录中,而不是上面的一个目录。
  • 嘿,你是对的,我没有意识到这一点,在你发表评论之前,我将所有目录都切换到了 git 根目录,但仍然无法正常工作。我不得不删除 .git 文件并使用 git 重新开始,现在它可以工作了。非常感谢
  • 是的,如果您不想丢失项目历史记录,另一种选择是将所有 rails 文件移出嵌套的 angRails 目录,然后重新提交。如果您使用的是屏幕截图中显示的 RubyMine,当您拖放时它会使用 git mv

标签: ruby-on-rails ruby angularjs git heroku


【解决方案1】:

Rails 应用程序需要位于 GIT 存储库的项目根目录中。这意味着它应该与 Gemfile \app 等在同一目录中,而不是上面的一个目录。

您的典型 Rails 项目剖析:

.            Gemfile      app          db           test
..           Gemfile.lock bin          lib          tmp
.git         README.rdoc  config       log          vendor
.gitignore   Rakefile     config.ru    public

如果您正在使用屏幕截图中显示的 RubyMine,您可以简单地将文件拖放到 IDE 中,然后提交,因为它将在后台使用 git mv

【讨论】:

    猜你喜欢
    • 2013-05-25
    • 2023-03-31
    • 2012-05-23
    • 2019-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多