Cố gắng thực thi jekyll trên cygwin (x64) trên Windows khi tôi nhận được lỗi này mặc dù sử dụng tiền tố bundle exec.bundle exec - Bạn đã kích hoạt json X, nhưng Gemfile của bạn yêu cầu json Y
Không nên phụ thuộc được xác định trong Gemfile (tức là 1.8.6) được kích hoạt khi thực thi?
Mọi suy nghĩ về những gì đang xảy ra ở đây? Tôi hoàn toàn mới với thế giới của đá quý Ruby. Tôi đã xem xét khác "Bạn đã kích hoạt .." bài đăng hiển thị các thư tương tự nhưng câu trả lời không giải quyết được vấn đề của tôi.
$ bó Jekyll exec phục vụ
$ bundle exec jekyll serve
/cygdrive/c/Users/mochapenguin/.rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:40:in
`block in setup': You have already activated json 2.0.2, but your Gemfile requires json 1.8.6.
Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
Môi trường
- Cygwin x86_64 được cài đặt trên Windows 7
- RVM cài đặt trên Cygwin
$ rvm -v rvm 1.29.0 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/] $ ruby -v ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-cygwin]
Gemfile - cho dự án Jekyll
source 'https://rubygems.org'
require 'json'
require 'open-uri'
versions = JSON.parse(open('https://pages.github.com/versions.json').read)
gem 'github-pages', group: :jekyll_plugins
gem 'json', '~> 1.8.0'
môi trường $ ngọc
$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.10
- RUBY VERSION: 2.4.0 (2016-12-24 patchlevel 0) [x86_64-cygwin]
- INSTALLATION DIRECTORY: /cygdrive/c/Users/mochapenguin/.rvm/gems/ruby-2.4.0
- USER INSTALLATION DIRECTORY: /cygdrive/c/Users/mochapenguin/.gem/ruby/2.4.0
- RUBY EXECUTABLE: /cygdrive/c/Users/mochapenguin/.rvm/rubies/ruby-2.4.0/bin/ruby.exe
- EXECUTABLE DIRECTORY: /cygdrive/c/Users/mochapenguin/.rvm/gems/ruby-2.4.0/bin
- SPEC CACHE DIRECTORY: /cygdrive/c/Users/mochapenguin/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /cygdrive/c/Users/mochapenguin/.rvm/rubies/ruby-2.4.0/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-cygwin
- GEM PATHS:
- /cygdrive/c/Users/mochapenguin/.rvm/gems/ruby-2.4.0
- /cygdrive/c/Users/mochapenguin/.rvm/gems/[email protected]
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /cygdrive/c/Users/mochapenguin/.rvm/gems/ruby-2.4.0/bin
- /cygdrive/c/Users/mochapenguin/.rvm/gems/[email protected]/bin
- /cygdrive/c/Users/mochapenguin/.rvm/rubies/ruby-2.4.0/bin
- /usr/local/bin
- /usr/bin
- /cygdrive/c/Windows/system32
- /cygdrive/c/Windows
- /cygdrive/c/Windows/System32/Wbem
- /cygdrive/c/Windows/System32/WindowsPowerShell/v1.0
- /cygdrive/c/Program Files/Java/jdk1.8.0_121/bin
..... snip .....
- /cygdrive/c/Users/mochapenguin/AppData/Local/atom/bin
- /usr/lib/lapack
- /cygdrive/c/Users/mochapenguin/.rvm/bin
bó cập nhật
$ bundle update
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies...
Using i18n 0.8.1
Using json 1.8.6
Using minitest 5.10.1
Using thread_safe 0.3.6
Using public_suffix 2.0.5
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using colorator 1.1.0
Using ffi 1.9.18
Using multipart-post 2.0.0
Using forwardable-extended 2.6.0
Using gemoji 3.0.0
Using net-dns 0.8.0
Using sass 3.4.23
Using rb-fsevent 0.9.8
Using kramdown 1.13.2
Using liquid 3.0.6
Using mercenary 0.3.6
Using rouge 1.11.1
Using safe_yaml 1.0.4
Using mini_portile2 2.1.0
Using jekyll-paginate 1.1.0
Using jekyll-swiss 0.4.0
Using minima 2.0.0
Using unicode-display_width 1.1.3
Using bundler 1.14.6
Using tzinfo 1.2.3
Using addressable 2.5.0
Using coffee-script 2.4.1
Using ethon 0.10.1
Using rb-inotify 0.9.8
Using faraday 0.11.0
Using pathutil 0.14.0
Using jekyll-sass-converter 1.5.0
Using nokogiri 1.7.1
Using terminal-table 1.7.3
Using activesupport 4.2.7
Using jekyll-coffeescript 1.0.1
Using typhoeus 0.8.0
Using listen 3.0.6
Using sawyer 0.8.1
Using html-pipeline 2.5.0
Using jekyll-watch 1.5.0
Using octokit 4.6.2
Using jekyll 3.4.3
Using github-pages-health-check 1.3.3
Using jekyll-gist 1.4.0
Using jekyll-avatar 0.4.2
Using jekyll-default-layout 0.1.4
Using jekyll-feed 0.9.2
Using jekyll-github-metadata 2.3.1
Using jekyll-mentions 1.2.0
Using jekyll-optional-front-matter 0.1.2
Using jekyll-readme-index 0.1.0
Using jekyll-redirect-from 0.12.1
Using jekyll-relative-links 0.4.0
Using jekyll-seo-tag 2.1.0
Using jekyll-sitemap 1.0.0
Using jekyll-theme-architect 0.0.3
Using jekyll-theme-cayman 0.0.3
Using jekyll-theme-dinky 0.0.3
Using jekyll-theme-hacker 0.0.3
Using jekyll-theme-leap-day 0.0.3
Using jekyll-theme-merlot 0.0.3
Using jekyll-theme-midnight 0.0.3
Using jekyll-theme-minimal 0.0.3
Using jekyll-theme-modernist 0.0.3
Using jekyll-theme-primer 0.1.7
Using jekyll-theme-slate 0.0.3
Using jekyll-theme-tactile 0.0.3
Using jekyll-theme-time-machine 0.0.3
Using jekyll-titles-from-headings 0.1.5
Using jemoji 0.8.0
Using github-pages 132
Bundle updated!
bó exec - thông báo lỗi đầy đủ
$ bundle exec jekyll serve
/cygdrive/c/Users/mochapenguin/.rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:40:in `block in setup': You have already activated json 2.0.2, but your Gemfile requires json 1.8.6. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
from /cygdrive/c/Users/mochapenguin/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/forwardable.rb:228:in `each'
from /cygdrive/c/Users/mochapenguin/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/forwardable.rb:228:in `each'
from /cygdrive/c/Users/mochapenguin/.rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:25:in `map'
from /cygdrive/c/Users/mochapenguin/.rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:25:in `setup'
from /cygdrive/c/Users/mochapenguin/.rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler.rb:100:in `setup'
from /cygdrive/c/Users/mochapenguin/.rvm/gems/ruby-2.4.0/gems/bundler-1.14.6/lib/bundler/setup.rb:10:in `<top (required)>'
from /cygdrive/c/Users/mochapenguin/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /cygdrive/c/Users/mochapenguin/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
đá quý json
$ gem list json
*** LOCAL GEMS ***
json (default: 2.0.2, 1.8.6)
bó chương json
$ bundle show json
/cygdrive/c/Users/mochapenguin/.rvm/gems/ruby-2.4.0/gems/json-1.8.6
Không thể gỡ bỏ cài đặt một defaul t ngọc
$ gem uninstall json -v2.0.2
ERROR: While executing gem ... (Gem::InstallError)
gem "json" cannot be uninstalled because it is a default gem
CẬP NHẬT - 12-Apr-2017
Tôi không biết những gì vấn đề này vẫn còn, nhưng tôi cắt tỉa bớt những Gemfile này và nó không rơi vào một đống . Có lẽ nó bằng cách nào đó hoạt động khi những phụ thuộc phiên bản cụ thể không được thực thi.
source 'https://rubygems.org'
# sample suggested [here](https://jekyllrb.com/docs/github-pages/) and in github help
gem 'github-pages', group: :jekyll_plugins
CẬP NHẬT - 21-Apr-2017
Vấn đề này với bundler và hệ thống đá quý được đánh dấu at Gem Versioning and Bundler - Doing it right
sandbox Bundler của phụ thuộc vào khả năng của mình để có mặt tại rất bắt đầu quá trình Ruby, và do đó có khả năng đảm bảo rằng các phiên bản của tất cả các thư viện được nạp sẽ phản ánh các phiên bản được liệt kê trong Gemfile.lock. Bằng cách chạy một hệ thống thực thi, bạn đang thực hiện mã Ruby trước khi Bundler có thể sửa đổi đường dẫn tải và thay thế cơ chế tải bình thường của Rubygems, cho phép các gem không được quản lý tùy ý được nạp vào bộ nhớ. Khi điều đó xảy ra, tất cả các cược sẽ bị tắt.
Đây là những gì dường như đang xảy ra trong tình huống này.
Nhưng, như đã đề cập ở trên - không thể gỡ cài đặt hệ thống json 2.0.2 gem.
Bạn đã tìm thấy giải pháp nào cho điều này chưa? – meeDamian
Xin lỗi bạn đời. Cập nhật của tôi từ ngày 12 tháng 4 là tốt nhất tôi nhận được. Tôi không nhìn xa hơn vì tôi chỉ cần nó để chạy lệnh jekyll. Tôi tin rằng bạn cũng có thể xác định bộ đá quý. Đó có thể là lựa chọn tốt nhất tiếp theo trong các trường hợp hiện tại. HTH. – JetStream