2017-05-18 7 views
0

를 설치 레일의 2.3.3다양한 어려움을 서로 다른 버전의 레일 애플 리케이션을 만들고 <code>rbenv -global</code> 내 루비 버전에 따라 경찰 슈 프레

버전입니다 내가 가진 :

처음
*** LOCAL GEMS *** 

rails (5.1.1, 5.0.0) 

, 내 목표와 레일을 만드는 것이 었습니다 주연. Spree README 내가 다음에 다음 보석을 추가 한 다음

rails new spree_app

gemfile : 평소처럼 나는으로 시작 그런

gem 'spree', '~> 3.2.0' 
gem 'spree_auth_devise', '~> 3.2.0.beta' 
gem 'spree_gateway', '~> 3.2.0.beta' 

, 내가 bundle install 나는 다음과 같은 오류가 만난거야을 실행했을 때 :

Bundler could not find compatible versions for gem "rails": 
    In snapshot (Gemfile.lock): 
    rails (= 5.1.1) 

    In Gemfile: 
    rails (~> 5.1.1) 

    spree (~> 3.2.0) was resolved to 3.2.0, which depends on 
     spree_frontend (= 3.2.0) was resolved to 3.2.0, which depends on 
     canonical-rails (~> 0.1.0) was resolved to 0.1.2, which depends on 
      rails (< 5.1, >= 4.1) 

    spree (~> 3.2.0) was resolved to 3.2.0, which depends on 
     spree_core (= 3.2.0) was resolved to 3.2.0, which depends on 
     deface (~> 1.0) was resolved to 1.2.0, which depends on 
      rails (>= 4.1) 

    spree (~> 3.2.0) was resolved to 3.2.0, which depends on 
     spree_core (= 3.2.0) was resolved to 3.2.0, which depends on 
     rails (~> 5.0.0) 

Running `bundle update` will rebuild your snapshot from scratch, using only 
the gems in your Gemfile, which may resolve the conflict. 

제안 사항대로 bundle update을 실행하면 :

Bundler could not find compatible versions for gem "rails": 
    In Gemfile: 
    rails (~> 5.1.1) 

    spree (~> 3.2.0) was resolved to 3.2.0, which depends on 
     spree_core (= 3.2.0) was resolved to 3.2.0, which depends on 
     rails (~> 5.0.0) 

그래서 Spree는 Rails 5.0.0에 의존하며 5.1.1은 문제를 일으키는 것으로 보입니다. 이 점에 비추어 나는 gem 'rails', '~> 5.1.1'gem 'rails', '~> 5.0.0'으로 바 꾸었습니다. bundle updatebundle install으로 달렸고 모든 것이 제대로 bundler-wise로 작동했습니다.

문제는 이것이 내 레일 앱을 망가 뜨린 것 같습니다. 어떤 rails generate 명령이나 rails s을 실행하면 나에게 다음과 같은 오류 제공 :

/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.3/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `load_defaults' for #<Rails::Application::Configuration:0x0055a1cd5a36f0> (NoMethodError) 

내 인생을 내가 여기에 문제가 무엇인지 전혀 모른다.

내 마지막 시도는 시도와 5.0.0의 새로운 레일 응용 프로그램을 생성 할 수 있었다 :

rails _5.0.0_ new spree_app_2

그러나 어떤 이유로,이 차이도하지 않습니다 보인다. 이 앱의 gemfile에는 여전히 gem 'rails', '~> 5.1.1'이 포함되어 있으며 이전에 얻은 모든 오류가 발생했습니다.

그래서 나는 다른 버전의 레일을 관리하는 방법을 모르거나, Spree를 올바르게 설치하지 못하고 있거나 둘 다있는 것으로 보입니다. 감사합니다. 감사합니다.

업데이트 : 부분적인 해결책은

나는 아직도 5.1.1 이외의 모든 버전에서 레일 응용 프로그램을 생성하는 방법을 알고하지 않으며, 단순히 여전히 나를 위해 작동하지 않는 gemfile의 버전을 변경. 다른 변화가 필요하다고 생각됩니다.

gemfile의 레일 버전을 5.1.1에서 5.0.3으로 바꿨습니다. 5.0.2을 사용하여 Rails 앱의 /config/application.rb 파일을 조사한 결과, 다른 설정이 있다는 것을 알았습니다.

광산이 있었다 보았다 :

module AppName 
    class Application < Rails::Application 
    config.load_defaults 5.1 
    end 
end 

그리고 레일 5.0.2에서 생성 된 앱 관련 다음과 같이했다 :

module AppName 
    class Application < Rails::Application 
    config.generators do |generate| 
     generate.assets false 
    end 
    end 
end 

그래서 내가 그와 함께 있었다 무엇을 교환하고 일했다! 나는 그것이 왜 효과가 있었는지 알지 못하고 왜 내가 단지 5.0.3 레일즈 애플리케이션을 생성 할 수 있는지 알지 못한다.

답변

0

필자는 결코 Spree의 전문가는 아니지만, 모양은 5.1.1이며 Spree와 호환되지 않습니다. 당신의 Gemfile에서

spree (~> 3.2.0) was resolved to 3.2.0, which depends on spree_frontend (= 3.2.0) was resolved to 3.2.0, which depends on canonical-rails (~> 0.1.0) was resolved to 0.1.2, which depends on rails (< 5.1, >= 4.1)

다음, 트릭을 할해야 bundle

다음 rm Gemfile.lock을 가서 (다른 rails 보석 교체) 상단에 gem 'rails', '5.0.3'을 넣어.

+0

음,이 보석 의존성 문제를 제거한다,하지만 그냥 내가 원래 무슨 짓을했는지와 나는 얻을 번호 같은 '정의되지 않은 메서드 'load_defaults'<레일 :: 응용 :: 구성 : 0x0055e0414ccdf0> '오류 rails s' 나'rails generate'와 같은 레일스 명령어를 실행할 때마다. – Martin

+0

'gem install rails -v 5.0.3' 그리고'rails _5.0.3_ new application_name'은 어떨까요? –

+0

all-systems-보고 2.3.1. 2.3.3 진짜 빠른 시도! –

관련 문제