【问题标题】:Add line of code to Gemfile that already contains that line of code将代码行添加到已包含该代码行的 Gemfile
【发布时间】:2015-09-22 17:58:14
【问题描述】:

我的博客基于 Jekyll Bootstrap,我最近设置了一台装有 Windows 10 的新机器。

当我在本地机器上启动服务器进行测试时,它说我应该在我的 Gemfile 中添加一些内容:

$ jekyll serve -w
Configuration file: C:/Users/mark/Documents/ploeh/Blog/_config.yml
            Source: C:/Users/mark/Documents/ploeh/Blog
       Destination: C:/Users/mark/Documents/ploeh/Blog/_site
      Generating...
                    done.
  Please add the following to your Gemfile to avoid polling for changes:
    gem 'wdm', '>= 0.1.0' if Gem.win_platform?
 Auto-regeneration: enabled for 'C:/Users/mark/Documents/ploeh/Blog'
Configuration file: C:/Users/mark/Documents/ploeh/Blog/_config.yml
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.

如您所见,它告诉我在 Gemfile 中添加一行。不幸的是,我已经尝试过这样做,但似乎没有任何区别:

$ cat Gemfile
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
source 'https://rubygems.org'

如您所见,有问题的行已经在我的 Gemfile 中。

在 Gemfile 中移动东西没有任何区别:

source 'https://rubygems.org'
gem 'wdm', '>= 0.1.0' if Gem.win_platform?

为什么会这样说,我应该在意吗?如果我应该关心,那么我该如何解决这个问题?

以防万一,这是我的 Ruby 版本:

$ ruby --version
ruby 2.2.2p95 (2015-04-13 revision 50295) [x64-mingw32]

其他版本信息:

$ gem list

*** LOCAL GEMS ***

bigdecimal (1.2.6)
blankslate (2.1.2.4)
celluloid (0.16.0)
classifier-reborn (2.0.3)
coffee-script (2.4.1)
coffee-script-source (1.9.1.1)
colorator (0.1)
execjs (2.6.0)
fast-stemmer (1.0.2)
ffi (1.9.10 x64-mingw32)
hitimes (1.2.2)
io-console (0.4.3)
jekyll (2.5.3)
jekyll-coffeescript (1.0.1)
jekyll-gist (1.3.4)
jekyll-paginate (1.1.0)
jekyll-sass-converter (1.3.0)
jekyll-watch (1.2.1)
json (1.8.1)
kramdown (1.8.0)
liquid (2.6.3)
listen (2.10.1)
mercenary (0.3.5)
minitest (5.4.3)
parslet (1.5.0)
posix-spawn (0.3.11)
power_assert (0.2.2)
psych (2.0.8)
pygments.rb (0.6.3)
rake (10.4.2)
rb-fsevent (0.9.6)
rb-inotify (0.9.5)
rdoc (4.2.0)
redcarpet (3.3.2)
safe_yaml (1.0.4)
sass (3.4.18)
test-unit (3.0.8)
timers (4.0.4)
toml (0.1.2)
yajl-ruby (1.2.1)

【问题讨论】:

  • jekyll 版本是什么?
  • @Zahid 我如何找到 Jekyll 版本号? (对不起,如果这是一个愚蠢的问题,但我是 Ruby 新手。)
  • 也许你需要运行bundle install?此外,source 行应该在 Gemfile 的顶部。
  • 在控制台输入gem install wdm会发生什么?

标签: ruby jekyll jekyll-bootstrap


【解决方案1】:

在控制台中输入gem install wdm,看看是否能解决问题。

【讨论】:

  • 是的,根据this 安装wdm 0.1.1 应该可以解决问题。
  • 谢谢,对我来说它有效 - gem install wdm 并将 gem 'wdm', '>= 0.1.0' 添加到 Gemfile,然后删除 Gemfile.lock 并在控制台中写入 bundle install
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-04-04
  • 1970-01-01
  • 1970-01-01
  • 2012-08-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多