中间人服务器错误与'listen'3.0.3 gem而不是2.10.1

时间:2015-08-16 16:11:40

标签: bundler middleman

我在Windows 8.1上运行并尝试运行'middleman server'(使用gem版本2.4.8和Middleman版本3.3.12)。这样做时我收到以下错误(请参阅下面的附录中的完整错误消息):“您已经激活了listen 3.0.3,但您的Gemfile需要监听2.10.1”

然而,宝石'Listen'并没有明确地写在我的gemfile中,必须是与其他东西的依赖。

所以我做的是明确地添加我的gemfile:

gem 'listen', '~> 2.10.1'

然后再次运行

$bundle install

然而,当我再次运行'$ middleman server'时,它不起作用。所以在我的终端中,我查看我所拥有的'listen'宝石版本,并看到它是:

C:\Users\Edouard\Desktop\stylus>bundle show listen
C:/Ruby22/lib/ruby/gems/2.2.0/gems/listen-2.10.1

有人会如何解决这个问题?因为我没有线索..

附录 - 我得到的整个错误信息是:

C:\Users\Edouard\Desktop\stylus>middleman server
WARN: Unresolved specs during Gem::Specification.reset:
rack (< 2.0, >= 1.0, >= 1.0.0, >= 1.4.5)
uber (~> 0.0.4)
activesupport (>= 3.1, ~> 4.1)
ffi (>= 0.5.0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:34:in `block in setup': You have already activated listen 3.0.3, but your Gem
file requires listen 2.10.1. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:19:in `setup'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.rb:127:in `setup'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/setup.rb:8:in `<top (required)>'
from C:/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from C:/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/middleman-core-3.4.0/lib/middleman-core/load_paths.rb:29:in `setup_load_paths'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/middleman-core-3.4.0/bin/middleman:10:in `<top (required)>'
from C:/Ruby22/bin/middleman:23:in `load'
from C:/Ruby22/bin/middleman:23:in `<main>'

2 个答案:

答案 0 :(得分:0)

我遇到了同样的麻烦:middleman server error with 'listen' 3.0.3 gem instead of 2.10.1

尝试删除/Gemfile.lock和exec bundle install

这对我有用。

答案 1 :(得分:0)

该问题显然与Windows 8.1上的gem middleman-deploy有关。 这是我使用github应用的解决方案:

  • 从gemfile中删除middleman-deploy

  • 在与gemfile相同的文件夹中创建一个rakefile(没有任何扩展名),您需要在其中放置'middleman gh-pages'

  • 然后在对工作进行一些更改后,在主分支上执行commit

  • 然后执行rake publish