我最近发现
每当我尝试运行
2 3 4 5 6 7 | 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:
2 | xcode-select: error: command line tools are already installed, use"Software Update" to install updates |
重新安装 Jekyll
检查 ruby?? 版本并(重新)安装 bundler
所以我尝试像第一次一样重新安装 Jekyll:
2 3 4 5 6 7 8 | 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,其中包含:
2 | source 'https://rubygems.org' |
捆绑安装(问题来了)
然后在包含 Gemfile 的目录中运行:
这里,安装不工作,它说:
2 3 4 5 6 7 8 | 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 |
所以我尝试了
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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 |
我注意到我的
2 3 4 5 6 7 8 | 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] ... |
但不在我的
所以,也许我做了一些改变版本的事情。 (我最近安装了
我对 Ruby、Gems 系统等一无所知。也许解决方案很明显,但我尝试了几件事但没有成功。
(对不起,有点长,但我想尽可能清楚!)
我也不使用 Ruby,但我在 Mac OS 10.12.6 上遇到了类似的问题,我是这样解决的。
这很可能是由于系统 Ruby 环境和 Jekyll 之间的一些分歧造成的,最简单的解决方法是完全创建一个新环境。
首先,您应该使用 rvm 来管理您的 ruby?? 版本,以避免删除系统 Ruby 并破坏您的操作系统。设置 rvm 后,运行
安装 Ruby 2.3.3(这是我使用的)。完成后,将其设为系统中的默认 Ruby 版本:
然后我做了以下事情:
2 3 | gem install jekyll bundle install |
杰基尔又为我工作了。
希望对您有所帮助。
也可能是你错误地安装了 Jekyll 的多个依赖项。在那种情况下
可能会起作用,或者删除一个或多个 Jekyll 安装。
查找
然后保留上面的一个并删除其余的安装。
jeklly 捆绑新网站时遇到同样的问题。
试试这个:
2 | gem install bundler jekyll |
这就是我不需要 sudo 来安装 bundler jekyll 的方式。
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | 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 ------------------------------------------------- |
我不是 mac 用户,对 ruby?? 不是很熟悉,但是当我看到
据我了解,您可以使用 devkit 获得 ruby??,也可以不使用 devkit 获得 ruby??,如果没有 devkit,则无法构建所需的某些 gem。在 PC 上,需要 devkit 才能安装所有 jekyll 依赖项。
我找到了一个解决方案,我认为它非常不干净,但现在可以使用。
我在
当我尝试运行 jekyll 时,错误输出表明它在 所以,我手动复制了 我猜我复制的文件对于我拥有的 Ruby 版本可能已经过时(?),但它工作得很好。 也许有更传统的方法可以让它发挥作用?
我正在学习如何使用Nokogiri,根据这段代码我遇到了一些问题:require'rubygems'require'mechanize'post_agent=WWW::Mechanize.newpost_page=post_agent.get('http://www.vbulletin.org/forum/showthread.php?t=230708')puts"\nabsolutepathwithtbodygivesnil"putspost_page.parser.xpath('/html/body/div/div/div/div/div/table/tbody/tr/td/div
总的来说,我对ruby还比较陌生,我正在为我正在创建的对象编写一些rspec测试用例。许多测试用例都非常基础,我只是想确保正确填充和返回值。我想知道是否有办法使用循环结构来执行此操作。不必为我要测试的每个方法都设置一个assertEquals。例如:describeitem,"TestingtheItem"doit"willhaveanullvaluetostart"doitem=Item.new#HereIcoulddotheitem.name.shouldbe_nil#thenIcoulddoitem.category.shouldbe_nilendend但我想要一些方法来使用
我有一个字符串input="maybe(thisis|thatwas)some((nice|ugly)(day|night)|(strange(weather|time)))"Ruby中解析该字符串的最佳方法是什么?我的意思是脚本应该能够像这样构建句子:maybethisissomeuglynightmaybethatwassomenicenightmaybethiswassomestrangetime等等,你明白了......我应该一个字符一个字符地读取字符串并构建一个带有堆栈的状态机来存储括号值以供以后计算,还是有更好的方法?也许为此目的准备了一个开箱即用的库?
我有一个Ruby程序,它使用rubyzip压缩XML文件的目录树。gem。我的问题是文件开始变得很重,我想提高压缩级别,因为压缩时间不是问题。我在rubyzipdocumentation中找不到一种为创建的ZIP文件指定压缩级别的方法。有人知道如何更改此设置吗?是否有另一个允许指定压缩级别的Ruby库? 最佳答案 这是我通过查看rubyzip内部创建的代码。level=Zlib::BEST_COMPRESSIONZip::ZipOutputStream.open(zip_file)do|zip|Dir.glob("**/*")d
类classAprivatedeffooputs:fooendpublicdefbarputs:barendprivatedefzimputs:zimendprotecteddefdibputs:dibendendA的实例a=A.new测试a.foorescueputs:faila.barrescueputs:faila.zimrescueputs:faila.dibrescueputs:faila.gazrescueputs:fail测试输出failbarfailfailfail.发送测试[:foo,:bar,:zim,:dib,:gaz].each{|m|a.send(m)resc
很好奇,就使用rubyonrails自动化单元测试而言,你们正在做什么?您是否创建了一个脚本来在cron中运行rake作业并将结果邮寄给您?git中的预提交Hook?只是手动调用?我完全理解测试,但想知道在错误发生之前捕获错误的最佳实践是什么。让我们理所当然地认为测试本身是完美无缺的,并且可以正常工作。下一步是什么以确保他们在正确的时间将可能有害的结果传达给您? 最佳答案 不确定您到底想听什么,但是有几个级别的自动代码库控制:在处理某项功能时,您可以使用类似autotest的内容获得关于哪些有效,哪些无效的即时反馈。要确保您的提
这似乎应该有一个直截了当的答案,但在Google上花了很多时间,所以我找不到它。这可能是缺少正确关键字的情况。在我的RoR应用程序中,我有几个模型共享一种特定类型的字符串属性,该属性具有特殊验证和其他功能。我能想到的最接近的类似示例是表示URL的字符串。这会导致模型中出现大量重复(甚至单元测试中会出现更多重复),但我不确定如何让它更DRY。我能想到几个可能的方向...按照“validates_url_format_of”插件,但这只会让验证干给这个特殊的字符串它自己的模型,但这看起来很像重溶液为这个特殊的字符串创建一个ruby类,但是我如何得到ActiveRecord关联这个类模型
假设我做了一个模块如下:m=Module.newdoclassCendend三个问题:除了对m的引用之外,还有什么方法可以访问C和m中的其他内容?我可以在创建匿名模块后为其命名吗(就像我输入“module...”一样)?如何在使用完匿名模块后将其删除,使其定义的常量不再存在? 最佳答案 三个答案:是的,使用ObjectSpace.此代码使c引用你的类(class)C不引用m:c=nilObjectSpace.each_object{|obj|c=objif(Class===objandobj.name=~/::C$/)}当然这取决于
我试图在一个项目中使用rake,如果我把所有东西都放到Rakefile中,它会很大并且很难读取/找到东西,所以我试着将每个命名空间放在lib/rake中它自己的文件中,我添加了这个到我的rake文件的顶部:Dir['#{File.dirname(__FILE__)}/lib/rake/*.rake'].map{|f|requiref}它加载文件没问题,但没有任务。我现在只有一个.rake文件作为测试,名为“servers.rake”,它看起来像这样:namespace:serverdotask:testdoputs"test"endend所以当我运行rakeserver:testid时
出于纯粹的兴趣,我很好奇如何按顺序创建PI,而不是在过程结果之后生成数字,而是让数字在过程本身生成时显示。如果是这种情况,那么数字可以自行产生,我可以对以前看到的数字实现垃圾收集,从而创建一个无限系列。结果只是在Pi系列之后每秒生成一个数字。这是我通过互联网筛选的结果:这是流行的计算机友好算法,类机器算法:defarccot(x,unity)xpow=unity/xn=1sign=1sum=0loopdoterm=xpow/nbreakifterm==0sum+=sign*(xpow/n)xpow/=x*xn+=2sign=-signendsumenddefcalc_pi(digits