加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

你如何用pg gemfile和Rails 3.1修复这个Heroku错误?

发布时间:2020-12-17 02:11:37 所属栏目:百科 来源:网络整理
导读:我正在尝试将一个Rails 3.1应用程序(使用CoffeeScript)上传到Heroku.显然,这已有问题 (https://stackoverflow.com/questions/6075961/problem-deploying-rails-3-1-project-to-heroku-could-not-find-a- javascript-runtim),所以我把它添加到我的Gemfile: g
我正在尝试将一个Rails 3.1应用程序(使用CoffeeScript)上传到Heroku.显然,这已有问题
(https://stackoverflow.com/questions/6075961/problem-deploying-rails-3-1-project-to-heroku-could-not-find-a- javascript-runtim),所以我把它添加到我的Gemfile:

group :production do
  gem 'therubyracer-heroku','0.8.1.pre3'
end

然后,经过几次搞乱之后,我发现我必须做以下事情:

group :production do
  gem 'therubyracer-heroku','0.8.1.pre3'
  gem 'pg'
  # pg from https://stackoverflow.com/questions/6410623/heroku-error-when-launch-rails3-1-app-missing-postgres-gem
end

现在我遇到了这个错误:“您已经在开发中修改了Gemfile,但没有将生成的快照(Gemfile.lock)检查到版本控制中”

git push heroku master
Counting objects: 5,done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3),done.
Writing objects: 100% (3/3),402 bytes,done.
Total 3 (delta 2),reused 0 (delta 0)

-----> Heroku receiving push
-----> Rails app detected
-----> Detected Rails is not set to serve static_assets
       Installing rails3_serve_static_assets... done
-----> Configure Rails 3 to disable x-sendfile
       Installing rails3_disable_x_sendfile... done
-----> Configure Rails to log to stdout
       Installing rails_log_stdout... done
-----> Gemfile detected,running Bundler version 1.0.7
       Unresolved dependencies detected; Installing...
       Using --without development:test
       You have modified your Gemfile in development but did not check
       the resulting snapshot (Gemfile.lock) into version control

       You have added to the Gemfile:
       * pg
       FAILED: http://devcenter.heroku.com/articles/bundler
 !     Heroku push rejected,failed to install gems via Bundler

好吧,即使在我运行bundle update之后,也没有更新的Gemfile.lock来提交.这是怎么回事?我如何部署到Heroku?我认为Ruby on Rails和Heroku应该很容易上手!

解决方法

有趣的时机因为我最近能够将一个Rails 3.1应用程序部署到Heroku.首先,确保Gemfile.lock确实已检入版本控制.然后,考虑使用这个:

group :production do
  gem 'therubyracer','~> 0.9.3.beta1'
end

这对我来说很完美,我也使用’pg’宝石.现在,我从来没有得到你做过的错误 – 但我知道我上面指定的’therubyracer’宝石会处理Heroku(或者Sprockets’?)方面的JS错误.

祝好运.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读