{"id":1502,"date":"2016-06-11T12:48:36","date_gmt":"2016-06-11T17:48:36","guid":{"rendered":"http:\/\/osric.com\/chris\/accidental-developer\/?p=1502"},"modified":"2016-06-11T12:48:36","modified_gmt":"2016-06-11T17:48:36","slug":"middleman-error-block-in-replace_gem-middleman-cli-is-not-part-of-bundle","status":"publish","type":"post","link":"https:\/\/osric.com\/chris\/accidental-developer\/2016\/06\/middleman-error-block-in-replace_gem-middleman-cli-is-not-part-of-bundle\/","title":{"rendered":"Middleman error &#8211; `block in replace_gem&#8217;: middleman-cli is not part of the bundle. Add it to Gemfile."},"content":{"rendered":"<p>I ran into an error while setting up a <a href=\"https:\/\/middlemanapp.com\/\">Middleman<\/a> site on my PC. I already had <a href=\"https:\/\/www.ruby-lang.org\/en\/\">Ruby<\/a> and <a href=\"https:\/\/rubygems.org\/\">RubyGems<\/a> installed, so I followed the instructions to <a href=\"https:\/\/middlemanapp.com\/basics\/install\/\">install Middleman<\/a> and <a href=\"https:\/\/middlemanapp.com\/basics\/start_new_site\/\">start a new Middleman site<\/a>:<\/p>\n<p><code>gem install middleman<br \/>\nmiddleman init project<br \/>\ncd project<\/code><\/p>\n<p>The next step was to <a href=\"https:\/\/middlemanapp.com\/basics\/development_cycle\/\">start the preview web server<\/a>, which produced an error:<\/p>\n<p><code>$ bundle exec middleman server<br \/>\nDL is deprecated, please use Fiddle<br \/>\nc:\/RailsInstaller\/Ruby2.1.0\/lib\/ruby\/gems\/2.1.0\/gems\/bundler-1.7.7\/lib\/bundler\/r<br \/>\nubygems_integration.rb:256:in `block in replace_gem': middleman-cli is not part<br \/>\nof the bundle. Add it to Gemfile. (Gem::LoadError)<br \/>\n        from c:\/RailsInstaller\/Ruby2.1.0\/bin\/middleman:22:in `&lt;main&gt;'<\/code><\/p>\n<p><!--more--><\/p>\n<p>I took a look at the <em>Gemfile<\/em>:<\/p>\n<p><code>$ cat Gemfile<br \/>\n# If you do not have OpenSSL installed, change<br \/>\n# the following line to use 'http:\/\/'<br \/>\nsource 'https:\/\/rubygems.org'<\/p>\n<p># For faster file watcher updates on Windows:<br \/>\ngem 'wdm', '~&gt; 0.1.0', platforms: [:mswin, :mingw]<\/p>\n<p># Windows does not come with time zone data<br \/>\ngem 'tzinfo-data', platforms: [:mswin, :mingw, :jruby]<\/p>\n<p># Middleman Gems<\/code><\/p>\n<p>That&#8217;s it&#8211;there&#8217;s nothing listed under the Middleman Gems. I appended a line to add the missing <em>middleman-cli<\/em> gem:<\/p>\n<p><code>$ echo 'gem \"middleman-cli\"' &gt;&gt; Gemfile<\/code><\/p>\n<p>I attempted to start the preview web server again:<\/p>\n<p><code>$ bundle exec middleman server<br \/>\nDL is deprecated, please use Fiddle<br \/>\nc:\/RailsInstaller\/Ruby2.1.0\/lib\/ruby\/gems\/2.1.0\/gems\/middleman-cli-4.1.9\/bin\/middleman:3:in `require': cannot load such file -- middleman-core\/profiling (LoadError)<br \/>\n        from c:\/RailsInstaller\/Ruby2.1.0\/lib\/ruby\/gems\/2.1.0\/gems\/middleman-cli-4.1.9\/bin\/middleman:3:in `&lt;top (required)&gt;'<br \/>\n        from c:\/RailsInstaller\/Ruby2.1.0\/bin\/middleman:23:in `load'<br \/>\n        from c:\/RailsInstaller\/Ruby2.1.0\/bin\/middleman:23:in `&lt;main&gt;'<\/code><\/p>\n<p>Now it&#8217;s missing another item, <em>middleman-core<\/em>. I decided to take a look at which Middleman gems were installed on my system:<\/p>\n<p><code>$ gem list --local | grep middleman<br \/>\nmiddleman (4.1.9)<br \/>\nmiddleman-cli (4.1.9)<br \/>\nmiddleman-core (4.1.9)<\/code><\/p>\n<p>I appended another line to the <em>Gemfile<\/em> to add the missing <em>middleman-core<\/em> gem:<\/p>\n<p><code>$ echo 'gem \"middleman-core\"' &gt;&gt; Gemfile<\/code><\/p>\n<p>The preview web server then started successfully:<\/p>\n<p><code>$ bundle exec middleman server<br \/>\nDL is deprecated, please use Fiddle<br \/>\nDL is deprecated, please use Fiddle<br \/>\n== The Middleman is loading<br \/>\n== View your site at \"http:\/\/localhost:4567\", \"http:\/\/192.168.200.196:4567\"<br \/>\n== Inspect your site configuration at \"http:\/\/localhost:4567\/__middleman\", \"http:\/\/192.168.200.196:4567\/__middleman\"<\/code><\/p>\n<p>Visiting http:\/\/localhost:4567 displayed the following:<\/p>\n<figure id=\"attachment_1510\" aria-describedby=\"caption-attachment-1510\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/osric.com\/chris\/accidental-developer\/2016\/06\/middleman-error-block-in-replace_gem-middleman-cli-is-not-part-of-bundle\/middleman-is-running\/\" rel=\"attachment wp-att-1510\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/osric.com\/chris\/accidental-developer\/wp-content\/uploads\/2016\/06\/middleman-is-running-300x226.png\" alt=\"Screen capture of default Middleman page on preview web server.\" width=\"300\" height=\"226\" class=\"size-medium wp-image-1510\" srcset=\"https:\/\/osric.com\/chris\/accidental-developer\/wp-content\/uploads\/2016\/06\/middleman-is-running-300x226.png 300w, https:\/\/osric.com\/chris\/accidental-developer\/wp-content\/uploads\/2016\/06\/middleman-is-running-768x578.png 768w, https:\/\/osric.com\/chris\/accidental-developer\/wp-content\/uploads\/2016\/06\/middleman-is-running.png 790w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1510\" class=\"wp-caption-text\">Screen capture of default Middleman page on preview web server.<\/figcaption><\/figure>\n<p>Presumably the missing gems are supposed to be included by default when setting up a new Middleman project. I&#8217;m not sure why they weren&#8217;t included in my project, but in case you are running into the same problem I hope you find this post helpful.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I ran into an error while trying to start a newly-created Middleman project: `block in replace_gem&#8217;: middleman-cli is not part of the bundle. I was able to address this and a subsequent error by adding 2 Ruby gems to the project&#8217;s Gemfile.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[405,404],"class_list":["post-1502","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-middleman","tag-ruby"],"_links":{"self":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/1502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/comments?post=1502"}],"version-history":[{"count":7,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/1502\/revisions"}],"predecessor-version":[{"id":1513,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/1502\/revisions\/1513"}],"wp:attachment":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/media?parent=1502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/categories?post=1502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/tags?post=1502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}