【问题标题】:Deploying Ruby on Rails to Heroku将 Ruby on Rails 部署到 Heroku
【发布时间】:2023-03-31 21:45:01
【问题描述】:

我正在尝试将 RoR 应用程序上传到 Heroku。

操作系统 - Ubuntu,ruby 版本 - 2.2.2p95,rails 版本 - 4.2.1,数据库 - PostgreSQL,通过 BrightBox(树屋教程)安装 RoR,使用 git push heroku master 上传。

在本地服务器应用程序工作正常。当我将它推送到heroku时,它会给出一个错误:

The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.
If you are the application owner check the logs for more information.

日志文件说:

/usr/bin/env: ruby2.2: No such file or directory

我已经尝试了所有可能的变体,我可以在 Internet 上找到:

rake rails:update:bin

Remove bin from ~/.gitignore (But there is no such file)

heroku config:set PATH=bin:vendor/bundle/ruby/2.2.2/bin:/usr/local/bin:/usr/bin:/bin

Adding this to the GemFile: ruby '2.2.2'

Changed #!/usr/bin/env ruby2.2(.2 (not sure about ".2")) to #!/usr/bin/env ruby (in bin/rake, bin/bundle and bin/rails)

heroku run rails db:migrate
rake rails:update:bin

ln -s /usr/bin/nodejs /usr/bin/node

要上传到heroku,我已经配置了git,然后登录heroku,然后是“heroku create”,然后是“git push heroku master”,然后是“heroku open”

还有许多其他人...有什么办法可以解决这个问题吗?

【问题讨论】:

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


    【解决方案1】:

    您是否安装了 gem rails12_factor 和 config.assets.compile = true ?

    【讨论】:

    • 我已经安装了它,但它并没有改变任何东西。我不确定第二行,你写道。我在哪里可以找到它?感谢您的回复。
    • 其实是 rails_12factor
    • 是的,抱歉打错了。第二行应该在您的 config/environments/production.rb 文件中。
    • 我按照你说的做了,但我仍然收到这个错误... (/usr/bin/env: ruby​​2.2: No such file or directory)
    • 我真的不知道这到底是怎么回事……也许和BrightBox有关?
    【解决方案2】:

    不确定您是否输入错误或其他原因。但是 heroku run rails db:migrate 不起作用,它应该是 heroku run rake db:migrate 。这可能是因为您没有根页面。预编译问题等

    运行heroku logs -a app_name 以查看实际日志。

    【讨论】:

    • 实际上,它们都不起作用。日志文件的内容,我在上面写过。感谢您的回复。
    猜你喜欢
    • 2013-05-25
    • 2012-05-23
    • 2019-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多