Почему моя команда jekyll больше не работает? - PullRequest
0 голосов
/ 13 ноября 2018

Я недавно обнаружил, что команда jekyll больше не работает на моем компьютере, после того, как она идеально использовалась в течение нескольких месяцев.

Всякий раз, когда я пытаюсь выполнить команду jekyll, она говорит:

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/dependency.rb:319:in `to_specs':
    Could not find 'jekyll' (>= 0) among 34 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/Mael/.gem/ruby/2.3.0:/Library/Ruby/Gems/2.3.0:/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0',
    execute `gem env` for more information
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/dependency.rb:328:in `to_spec'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
    from /usr/local/bin/jekyll:22:in `<main>'

Я в MacOS Sierra (10.12.6).

Xcode установлен

У меня на компьютере установлен Xcode:

$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

Переустановка Jekyll

Проверка версии ruby ​​и (пере) установка пакета

Поэтому я попытался переустановить Jekyll, как и в первый раз:

$ ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin16]

$ sudo gem install bundler
Successfully installed bundler-1.17.1
Parsing documentation for bundler-1.17.1
Done installing documentation for bundler after 4 seconds
1 gem installed

Создание Gemfile

Я создал Gemfile, который содержит:

gem 'github-pages'
source 'https://rubygems.org'

Bundle install (вот и проблемы)

И побежал, в каталог, содержащий Gemfile:

$ bundle install

Здесь установка не работает, она говорит:

An error occurred while installing commonmarker (0.17.13), and Bundler cannot continue.
Make sure that `gem install commonmarker -v '0.17.13' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  github-pages was resolved to 192, which depends on
    jekyll-commonmark-ghpages was resolved to 0.1.5, which depends on
      jekyll-commonmark was resolved to 1.2.0, which depends on
        commonmarker

Итак, я попробовал команду gem install commonmarker -v '0.17.13' --source 'https://rubygems.org/', и она говорит:

Building native extensions.  This could take a while...
ERROR:  Error installing commonmarker:
        ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.3.0/gems/commonmarker-0.17.13/ext/commonmarker
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20181112-6105-u9aca2.rb extconf.rb
creating Makefile

current directory: /Library/Ruby/Gems/2.3.0/gems/commonmarker-0.17.13/ext/commonmarker
make "DESTDIR=" clean

current directory: /Library/Ruby/Gems/2.3.0/gems/commonmarker-0.17.13/ext/commonmarker
make "DESTDIR="
make: *** No rule to make target `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin16/ruby/config.h', needed by `arena.o'.  Stop.

make failed, exit code 2

Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/commonmarker-0.17.13 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-16/2.3.0/commonmarker-0.17.13/gem_make.out

Я заметил, что у меня есть несколько jekyll и github-pages драгоценных камней в моем каталоге /Library/Ruby/Gems/2.0.0/gems (2.0.0) :

github-pages-146
github-pages-health-check-1.3.5
...
jekyll-3.4.5
jekyll-avatar-0.4.2
jekyll-coffeescript-1.0.1
[and several other jekyll directories]
...

Но не в моей директории /Library/Ruby/Gems/2.3.0/gems (2.3.0) ! (тот, на который, похоже, нацелен GEM_PATH при выполнении команды jekyll)

Итак, возможно, я сделал что-то, что изменило версию или что-то в этом роде. (Я недавно установил osxfuse и sshfs (через brew), я не знаю, связано ли это с проблемой?)

Я ничего не знаю о Ruby, системе Gems и так далее. Возможно, решение очевидно, но я попробовал несколько вещей безуспешно.

(Извините, это немного долго, но я хотел быть максимально ясным!)

Ответы [ 4 ]

0 голосов
/ 31 января 2019

У меня такая же проблема с jeklly для комплектации нового сайта.

попробуйте это:

xcode-select --install
gem install bundler jekyll

Мне не нужен sudo для установки пакета jekyll.

Install the Command Line Tools:
  xcode-select --install

abcLabdeMacBook-Air:zeppelin-master abclab$ xcode-select --install
xcode-select: note: install requested for command line developer tools
abcLabdeMacBook-Air:zeppelin-master abclab$ gem install bundler jekyll
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
abcLabdeMacBook-Air:zeppelin-master abclab$ bundle install
Ignoring eventmachine-1.2.7 because its extensions are not built.  Try: gem pristine eventmachine --version 1.2.7
Ignoring ffi-1.9.25 because its extensions are not built.  Try: gem pristine ffi --version 1.9.25
Ignoring http_parser.rb-0.6.0 because its extensions are not built.  Try: gem pristine http_parser.rb --version 0.6.0
Fetching gem metadata from http://rubygems.org/.................
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies.....
Using concurrent-ruby 1.1.4
Following files may not be writable, so sudo is needed:
  /Library/Ruby/Gems/2.3.0
  /Library/Ruby/Gems/2.3.0/build_info
  /Library/Ruby/Gems/2.3.0/cache
  /Library/Ruby/Gems/2.3.0/doc
  /Library/Ruby/Gems/2.3.0/extensions
  /Library/Ruby/Gems/2.3.0/gems
  /Library/Ruby/Gems/2.3.0/specifications
Using i18n 0.9.5
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 4.2.10
Using public_suffix 2.0.5
Using addressable 2.5.2
Using execjs 2.7.0
Using autoprefixer-rails 9.4.7
Using bundler 2.0.1
Using chunky_png 1.3.11
Using coffee-script-source 1.11.1
Using coffee-script 2.4.1
Using colorator 1.1.0
Using ruby-enum 0.7.2
Fetching commonmarker 0.17.13


Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle install --path vendor/bundle

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

  Password: 


Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle install --path vendor/bundle

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

  Password: 
Installing commonmarker 0.17.13 with native extensions
Fetching multi_json 1.13.1
Installing multi_json 1.13.1
Fetching sass 3.4.25
Installing sass 3.4.25
Fetching compass-core 1.0.3
Installing compass-core 1.0.3
Fetching compass-import-once 1.0.5
Installing compass-import-once 1.0.5
Using rb-fsevent 0.10.3
Fetching ffi 1.10.0
Installing ffi 1.10.0 with native extensions
Fetching rb-inotify 0.10.0
Installing rb-inotify 0.10.0
Fetching compass 1.0.3
Installing compass 1.0.3
Fetching dnsruby 1.61.2
Installing dnsruby 1.61.2
Fetching eventmachine 1.2.7
Installing eventmachine 1.2.7 with native extensions
Fetching http_parser.rb 0.6.0
Installing http_parser.rb 0.6.0 with native extensions
Using em-websocket 0.5.1
Fetching ethon 0.12.0
Installing ethon 0.12.0
Fetching multipart-post 2.0.0
Installing multipart-post 2.0.0
Fetching faraday 0.15.4
Installing faraday 0.15.4
Using forwardable-extended 2.6.0
Fetching gemoji 3.0.0
Installing gemoji 3.0.0
Fetching sawyer 0.8.1
Installing sawyer 0.8.1
Fetching octokit 4.13.0
Installing octokit 4.13.0
Fetching typhoeus 1.3.1
Installing typhoeus 1.3.1
Fetching github-pages-health-check 1.8.1
Installing github-pages-health-check 1.8.1
Using jekyll-sass-converter 1.5.2
Using ruby_dep 1.5.0
Using listen 3.1.5
Fetching jekyll-watch 2.1.2
Installing jekyll-watch 2.1.2
Using kramdown 1.17.0
Using liquid 4.0.0
Using mercenary 0.3.6
Fetching pathutil 0.16.2
Installing pathutil 0.16.2
Fetching rouge 2.2.1
Installing rouge 2.2.1
Using safe_yaml 1.0.4
Fetching jekyll 3.7.4
Installing jekyll 3.7.4
Fetching jekyll-avatar 0.6.0
Installing jekyll-avatar 0.6.0
Fetching jekyll-coffeescript 1.1.1
Installing jekyll-coffeescript 1.1.1
Fetching jekyll-commonmark 1.2.0
Installing jekyll-commonmark 1.2.0
Fetching jekyll-commonmark-ghpages 0.1.5
Installing jekyll-commonmark-ghpages 0.1.5
Fetching jekyll-default-layout 0.1.4
Installing jekyll-default-layout 0.1.4
Fetching jekyll-feed 0.11.0
Installing jekyll-feed 0.11.0
Fetching jekyll-gist 1.5.0
Installing jekyll-gist 1.5.0
Fetching jekyll-github-metadata 2.9.4
Installing jekyll-github-metadata 2.9.4
Fetching mini_portile2 2.4.0
Installing mini_portile2 2.4.0
Fetching nokogiri 1.10.1
Installing nokogiri 1.10.1 with native extensions
Fetching html-pipeline 2.10.0
Installing html-pipeline 2.10.0
Fetching jekyll-mentions 1.4.1
Installing jekyll-mentions 1.4.1
Fetching jekyll-optional-front-matter 0.3.0
Installing jekyll-optional-front-matter 0.3.0
Fetching jekyll-paginate 1.1.0
Installing jekyll-paginate 1.1.0
Fetching jekyll-readme-index 0.2.0
Installing jekyll-readme-index 0.2.0
Fetching jekyll-redirect-from 0.14.0
Installing jekyll-redirect-from 0.14.0
Fetching jekyll-relative-links 0.5.3
Installing jekyll-relative-links 0.5.3
Fetching rubyzip 1.2.2
Installing rubyzip 1.2.2
Fetching jekyll-remote-theme 0.3.1
Installing jekyll-remote-theme 0.3.1
Using jekyll-seo-tag 2.5.0
Fetching jekyll-sitemap 1.2.0
Installing jekyll-sitemap 1.2.0
Fetching jekyll-swiss 0.4.0
Installing jekyll-swiss 0.4.0
Fetching jekyll-theme-architect 0.1.1
Installing jekyll-theme-architect 0.1.1
Fetching jekyll-theme-cayman 0.1.1
Installing jekyll-theme-cayman 0.1.1
Fetching jekyll-theme-dinky 0.1.1
Installing jekyll-theme-dinky 0.1.1
Fetching jekyll-theme-hacker 0.1.1
Installing jekyll-theme-hacker 0.1.1
Fetching jekyll-theme-leap-day 0.1.1
Installing jekyll-theme-leap-day 0.1.1
Fetching jekyll-theme-merlot 0.1.1
Installing jekyll-theme-merlot 0.1.1
Fetching jekyll-theme-midnight 0.1.1
Installing jekyll-theme-midnight 0.1.1
Fetching jekyll-theme-minimal 0.1.1
Installing jekyll-theme-minimal 0.1.1
Fetching jekyll-theme-modernist 0.1.1
Installing jekyll-theme-modernist 0.1.1
Fetching jekyll-theme-primer 0.5.3
Installing jekyll-theme-primer 0.5.3
Fetching jekyll-theme-slate 0.1.1
Installing jekyll-theme-slate 0.1.1
Fetching jekyll-theme-tactile 0.1.1
Installing jekyll-theme-tactile 0.1.1
Fetching jekyll-theme-time-machine 0.1.1
Installing jekyll-theme-time-machine 0.1.1
Fetching jekyll-titles-from-headings 0.5.1
Installing jekyll-titles-from-headings 0.5.1
Fetching jemoji 0.10.1
Installing jemoji 0.10.1
Using minima 2.5.0
Fetching unicode-display_width 1.4.1
Installing unicode-display_width 1.4.1
Fetching terminal-table 1.8.0
Installing terminal-table 1.8.0
Fetching github-pages 193
Installing github-pages 193
Fetching sass-media_query_combiner 0.0.7
Installing sass-media_query_combiner 0.0.7
Bundle complete! 4 Gemfile dependencies, 91 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Post-install message from compass:
    Compass is charityware. If you love it, please donate on our behalf at http://umdf.org/compass Thanks!
Post-install message from dnsruby:
Installing dnsruby...
  For issues and source code: https://github.com/alexdalitz/dnsruby
  For general discussion (please tell us how you use dnsruby): https://groups.google.com/forum/#!forum/dnsruby
Post-install message from html-pipeline:
-------------------------------------------------
Thank you for installing html-pipeline!
You must bundle Filter gem dependencies.
See html-pipeline README.md for more details.
https://github.com/jch/html-pipeline#dependencies
-------------------------------------------------
0 голосов
/ 18 ноября 2018

Я нашел решение, которое я считаю очень не чистым, но сейчас работает.

У меня есть две директории в /Library/Ruby/Gems/:

  • 2.0.0/
    • gems/
    • specifications/
    • ...
  • 2.3.0/
    • gems/
    • specifications/
    • ...

Вывод ошибки, когда я пытаюсь запустить jekyll, говорит, что он проверяет (среди прочего)) в /Library/Ruby/Gems/2.3.0, но, как я уже сказал в своем вопросе, там нет никакого файла, связанного с jekyll.

Итак, я вручную скопировал все файлы из /Library/Ruby/Gems/2.0.0/gems и /Library/Ruby/Gems/2.0.0/specifications и вставилих в /Library/Ruby/Gems/2.3.0/gems и /Library/Ruby/Gems/2.3.0/specifications соответственно.

Я полагаю, что скопированные файлы могут быть устаревшими для имеющейся у меня версии Ruby (?), но она отлично работает.

Может быть, есть более традиционный способ заставить его работать?

0 голосов
/ 06 декабря 2018

Я также не работаю с Ruby, но у меня была похожая проблема в Mac OS 10.12.6, и вот как я ее решил.

Вероятно, это вызвано некоторыми разногласиями между системной средой Ruby и Jekyll, и самый простой способ исправить это - вообще создать новую среду.

Сначала вы должны использовать rvm для управления версиями ruby, чтобы избежать удаления системного Ruby и поломки вашей ОС. После настройки rvm запустите

rvm install 2.3.3

для установки Ruby 2.3.3 (что я и использовал). После того, как это закончено, сделайте эту версию Ruby по умолчанию в вашей системе:

rvm --default use 2.3.3

тогда я сделал следующее:

gem install bundler
gem install jekyll
bundle install

и Джекилл снова работал на меня.

Надеюсь, это поможет.

0 голосов
/ 17 ноября 2018

Я не пользователь Mac и не очень знаком с ruby, но когда я вижу ERROR: Failed to build gem native extension, это обычно связано с отсутствием версии ruby, включающей devkit.

Как я понимаю, вы можете получить ruby ​​с devkit или ruby ​​без devkit, если нет devkit, он не может собрать некоторые драгоценные камни, которые ему нужны.На ПК необходим devkit для установки всех зависимостей jekyll.

...