Nice programing

Bundler : Gemfile을 변경 한 후 배포 모드로 설치하려고합니다.

nicepro 2020. 10. 7. 08:20
반응형

Bundler : Gemfile을 변경 한 후 배포 모드로 설치하려고합니다.


나는 번 들러와 카피 스트라 노를 처음 접했고 그것들을 함께 사용하려고 노력하고 있습니다. 배포하려고하면 다음 메시지가 표시됩니다.

Gemfile을 변경 한 후 배포 모드로 설치하려고합니다. 다른 곳에서`bundle install '을 실행하고 업데이트 된 Gemfile.lock을 버전 제어에 추가하십시오.

불만을 제기하는 시스템을 어떻게 만족 시킬지 모르겠고 문서를 읽었 기 때문에 불만이 제기되는 이유를 이해할 수 없습니다 .

Gemfile.lock이 존재하고 Gemfile (5)을 업데이트 한 경우 번 들러는 업데이트하지 않은 모든 gem에 대해 Gemfile.lock의 종속성을 사용하지만 업데이트 한 gem의 종속성을 다시 해결합니다. . 이 업데이트 프로세스에 대한 자세한 내용은 아래의 CONSERVATIVE UPDATING에서 찾을 수 있습니다.

나는 Bundler가 내 Gemfile이 예상했던 것과 다르다는 사실을 처리 할 수 ​​있음을 의미합니다. 도움이 필요하세요?

사양 : Ruby 1.9.3, Rails 3.2.3, Capistrano 2.12.0, Bundler 1.1.4, Windows 7, Posix 머신에 배포.

편집 : 내 Gemfile에는 다음과 같은 논리 블록이 포함되어 있습니다.

unless RbConfig::CONFIG['host_os'] === 'mingw32'
  # gem 'a' ...
end

당신이 관련을 얻고있는 오류 메시지가 Gemfile.lock당신 때문에 할 수 Gemfile및이 Gemfile.lock서로 일치하지 않습니다. 마지막으로 실행 한 이후 bundle install(또는 update) Gemfile에서 변경 한 것 같습니다 . 를 실행하면 bundle installGemfile에 대한 변경 사항으로 Gemfile.lock을 업데이트합니다.

bundle install로컬에서 실행 하고 Gemfile.lock그 후에 새로 업데이트 된 소스 제어에 체크인하십시오 . 그런 다음 배포를 시도하십시오.

편집 : 주석에서 알 수 있듯이 Gemfile의 조건은 한 플랫폼에서 유효한 Gemfile.lock을 생성하고 다른 플랫폼에서는 유효하지 않습니다. Gemfile에서 이러한 플랫폼 종속적 인 gem에 : platform 플래그를 제공 하면 비대칭을 해결할 수 있습니다.


vi .bundle / config

BUNDLE_FROZEN 옵션을 '1'에서 '0'으로 변경하십시오.

"번들 설치"수행


또는

"번들 구성"실행

"고정"값이 참인지 확인하십시오. 거짓으로 설정하십시오.

번들 구성 고정 거짓


글로벌 번 들러 구성에주의하십시오.

내 개발 환경에서 내 개발 환경에서 생성 된 ~/.bundle/config것과 내 CI / 프로덕션 환경 Gemfile.lock에서 생성 된 것과 다른 원인이되는 내 CI / 프로덕션 환경에없는 글로벌 구성 이 있습니다.

제 경우에는 github.https개발 환경에서 true 로 설정 했지만 CI / 프로덕션 환경에는 이러한 구성이 없었습니다. 이로 인해 두 Gemfile.lock파일이 달라졌습니다.


다음이 표시되면 ...

$ bundle install
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.

If this is a development machine, remove the Gemfile freeze
by running `bundle install --no-deployment`.

You have added to the Gemfile:
* source: rubygems repository https://rubygems.org/
* rails (~> 3.2)
. . .

... 그러면 문제는 공급 업체 / 캐시 디렉토리에 오래된 .gem 파일이있을 가능성이 큽니다.

아마도 $bundle install --deployment캐시에 "오래된".gem 파일을 넣은 이전에 실행 하셨나요?

어쨌든 다음을 실행하여이 오류를 지나칠 수 있습니다. bundle install --no-deployment

이것이 Rails의 많은 장점 중 하나입니다. 오류 메시지는 종종 문제를 해결하기 위해해야 ​​할 일을 정확히 알려줍니다.


내 특정 문제는 @JoshPinter가보고 한 것, 즉 번 들러가 github에서 gem을 검색하는 데 사용하는 프로토콜의 dev-vs-deploy 호스트 불일치와 관련이 있습니다.

긴 이야기를 짧게 만들기 위해 다음 Gemfile항목 을 수정하기 만하면되었습니다.

gem 'activeadmin', github: 'activeadmin'

...이 보안 구문 ( 참조 참조 ) :

gem 'activeadmin', git: 'https://github.com/activeadmin/activeadmin.git'

그리고 내 배포가 정상으로 돌아 왔습니다.


나를위한 솔루션은 여기에 나열된 다른 솔루션과 약간 달랐습니다. sidekiq에서 sidekiq-pro (번 들러 1.7.12+ 필요)로 업그레이드하려고했지만 travis-ci에서 "You are trying to install in deployment mode after changes your Gemfile"메시지가 계속 나타납니다.

travis-ci의 콘솔 출력을 조사한 결과 이전 버전의 번 들러가 사용되고 있음이 드러났습니다.

제 경우에는 travis.yml 파일을 편집하여 다음을 추가해야했습니다.

before_install: - gem update bundler

이로 인해 travis-ci가 최신 버전의 번 들러를 사용하고 오류 메시지가 사라졌습니다.


rm -fr .bundle

나를 위해 문제를 해결했습니다.


나는 전에 비슷한 것을 만났습니다. 문제를 해결하는 한 가지 방법은 서버에서 원하는 것보다 더 많은 공간을 차지할 수 있습니다.

bundle install --deployment 

and then try to deploy. This does something like install all of your gems into the vendor folder, which I believe is generally good to avoid... but will still probably work. My app used to behave like this, my solution was removing exact versions to download from in my Gemfile, and then rebundling and deploying.

gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git', :branch => 'master'

to

gem 'rails_admin'

Or you can do what it suggests, and Git your project off the production server onto a local machine, bundle it, and then repush onto your server. This solution might not be 100% correct but some of it worked for me... just thought I'd share. Goodluck


Another cause of the error:

This is a bit foolish, but i'm sure someone else will make the same mistake.

For Rails 4 Heroku added the gem rails_12factor. If you were using it before they added it, then you'll have these two gems:

gem 'rails_log_stdout',  github: 'heroku/rails_log_stdout'
gem 'rails3_serve_static_assets', github: 'heroku/rails3_serve_static_assets'

You have to remove them when you add the new one. (they're included). I think you can get away with it until you touch them lines in your gem file, then Heroku notices the duplication and cries out with the above error.

good luck with Rails 4.


In our case we were using a feature that wasn't available in an old version of bundler which ran on our production machine. Therefore it was enough to upgrade bundler, i.e. do a gem update bundler.


This might be a dangerous idea, but if absolutely must test something in a production deploy environment, you can edit the .bundle/config file

# This value is normally '1' 
# Set it to '0'
BUNDLE_FROZEN: '0'

Now invoke bundle, in my case I needed to update a specific gem, so this my command

RAILS_ENV=production bundle update <whatever gem>

You should probably change it back after the update, so things work like you expect, afterwards. Again, this is probably unsupported, and YMMV


I ran into this deploying a Nesta app after some gem updates. What worked for me was to delete the Gemfile.lock, run bundle install to re-generate it, and deploy again.


I ran into a similar issue however I did both bundle install and bundle update and Heroku still rejected my push.

I fixed the issue by just deleting Gemfile.lock and then running bundle install again. I then added, committed, and pushed that to my git repo. After that I had no problem pushing to Heroku.


for heroku, you don't have to change the syntax in the Gemfile. you can just add BUNDLE_GITHUB__HTTPS (note the double underscore) as an environment variable and set it to true (in your heroku app's dashboard under the Settings tab in the Config Vars section). this will switch the protocol from git:// to https:// for all such requests.


I had the error message when attempting push to Heroku. I found the following solution fixed.

  1. Git pull origin master
  2. Git status
  3. Git commit
  4. Git push origin master
  5. Git push heroku master

This issue can be related to submodules pointing to old versions of code. For me, I resolved this issue by updating my submodules

If you have submodules, try running:

git submodule update --init

bundle install


After this command, you can do your normal bundle install again:

bundle install --no-deployment

I read a dozen solutions on different resources but didn't find exactly what could help me in this situation

So I did find a solution. Exactly saying i read the error message attentively and there was a sollution: Run bundle install elsewhere. "Elsewhere" was my Cloud9 where i developed my app. So my steps

  1. copy Gemfile and Gemfile.lock from server to local machine with rsync command
  2. insert these two files into my RoR project (i used Cloud9)
  3. open Gemfile and make changes that i want. In my case i added gem 'thin'
  4. in terminal cd to my app on Cloud9 and run bundle install. in this case you will have a changed version of Gemfile.lock
  5. copy new Gemfile and Gemfile.lock on server using rsync
  6. cd to my app folder and again run bundle install --deployment --without development test DONE! Wish GOOD luck for all!

I don't care. This is what I did. It fixed it.

rm -rf .bundle 
rm -rf Gemfile.lock
bundle install

참고URL : https://stackoverflow.com/questions/11513623/bundler-you-are-trying-to-install-in-deployment-mode-after-changing-your-gemfil

반응형