Error msg when I try to init my first site

I got this msg error when I run middleman init mynewhost

Thanks in advance!

(erb):5:in template': uninitialized constant Middleman::VERSION (NameError) from /usr/local/lib/ruby/1.9.1/erb.rb:838:in eval’
from /usr/local/lib/ruby/1.9.1/erb.rb:838:in result' from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/actions/fi le_manipulation.rb:116:in block in template’
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/actions/cr
eate_file.rb:53:in call' from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/actions/cr eate_file.rb:53:in render’
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/actions/cr
eate_file.rb:46:in identical?' from /usr/local/lib/ruby/gems/1.9.1/gems/middleman-core-3.3.0/lib/middle man-core/cli/build.rb:292:in on_conflict_behavior’
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/actions/em
pty_directory.rb:113:in invoke_with_conflict_check' from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/actions/cr eate_file.rb:60:in invoke!’
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/actions.rb
:94:in action' from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/actions/cr eate_file.rb:25:in create_file’
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/actions/fi
le_manipulation.rb:115:in template' from /usr/local/lib/ruby/gems/1.9.1/gems/middleman-core-3.3.0/lib/middle man-core/templates.rb:66:in generate_bundler!’
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/command.rb
:27:in run' from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in invoke_command’
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:133:in block in invoke_all' from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:133:in each’
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:133:in map' from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:133:in invoke_all’
from /usr/local/lib/ruby/gems/1.9.1/gems/middleman-core-3.3.0/lib/middleman-core/cli/init.rb:53:in init' from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/command.rb:27:in run’
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in invoke_command' from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor.rb:359:in dispatch’
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/base.rb:440:in start' from /usr/local/lib/ruby/gems/1.9.1/gems/middleman-core-3.3.0/lib/middleman-core/cli.rb:77:in method_missing’
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/command.rb:29:in run' from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/command.rb:126:in run’
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in invoke_command' from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor.rb:359:in dispatch’
from /usr/local/lib/ruby/gems/1.9.1/gems/thor-0.19.1/lib/thor/base.rb:440:in start' from /usr/local/lib/ruby/gems/1.9.1/gems/middleman-core-3.3.0/lib/middleman-core/cli.rb:22:in start’
from /usr/local/lib/ruby/gems/1.9.1/gems/middleman-core-3.3.0/bin/middleman:18:in <top (required)>' from /usr/local/bin/middleman:23:in load’
from /usr/local/bin/middleman:23:in `’

My guess is that you need a more current version of Ruby. In the changelog, it says Middleman dropped support for Ruby 1.9.2 and under as of version 3.1. (From what I can tell, it looks like you are running v3.3 under Ruby 1.9.1)

Thanks for your answer!

When I check version installed I got this:

ignacio@s001:~$ ruby -v
ruby 1.9.3p545 (2014-02-24 revision 45159) [x86_64-linux]
ignacio@s001:~$ gem -v
2.2.2

In order to install ruby i have used this installation script:

#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libxml2-dev libxslt-dev libreadline6-dev libyaml-dev checkinstall
# apt-get -y install libmysqlclient-dev # uncomment for mysql support
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p545.tar.gz
tar -xvzf ruby-1.9.3-p545.tar.gz
cd ruby-1.9.3-p545/
./configure --prefix=/usr/local
make
checkinstall --type=debian --install=yes --fstrans=no --pakdir='~'

# instalando el soporte a SSL
cd ext/openssl/
ruby extconf.rb
make
checkinstall --type=debian --install=yes --fstrans=no --pakdir='~'

#Updagre Gem
#sudo gem update --system

Other thinks that I can do is install a different version of Ruby for example:

ruby-2.0.0-p451.tar.gz

download from http://ftp.ruby-lang.org/pub/ruby/

Let me try an I will tell you my results.

Thanks again!

I am getting the same error and my system is very fresh and current.
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
gem -v 2.2.2

Well i don’t have good news, I have installed ruby in other way (rvm), using the following commands, and i got the same error msg.

curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
rvm install ruby
rvm rubygems current

and finally; gem install middleman

middleman init mynewhost
      create  mynewhost/Gemfile
(erb):5:in `template': uninitialized constant Middleman::VERSION (NameError)
        from /home/ignacio/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/erb.rb:850:in `eval'
        from /home/ignacio/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/erb.rb:850:in `result'
        from /home/ignacio/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/actions/file_manipulation.rb:116:in `block in template'
        from /home/ignacio/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in `call'
        from /home/ignacio/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/actions/create_file.rb:53:in `render'
        from /home/ignacio/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `block (2 levels) in invoke!'
        from /home/ignacio/.rvm/gems/ruby-2.1.1/gems/thor-0.19.1/lib/thor/actions/create_file.rb:62:in `open'

I will continue trying tomorrow, I will do my best to find where the issue comes from. :blush:

Those are the exact steps I did on a clean Digital Ocean Ubuntu 12.04 box. Same exact error.

Hi, Yes!! I am using a clean ubuntu 12.04LTS installation on a Virtual Box machine… I have found these step from DO comunity article

I got the way to solve the issue:

gem install middleman-blog
gem install execjs
gem install therubyracer

I think that middleman-blog resolved gem dependency that were pending… I am not sure why, but these 3 lines resolved my issue and now I can play with middleman. :blush:

1 Like

Thanks @nachommm! This worked for me.

Does anybody know why these particular gems fix the issue? Or if it is a matter of fixing dependencies, which ones?

That worked for me also. After each gem I tried to init. Not until therubyracer was installed did it work. Thank you for figuring this out.

For me, it was gem install middleman-blog that solved the issue. Tried installing therubyracer first but it my OS (OS X I think x64?) wasn’t supported.

yes, the therubyracer is a dependency for execjs, middleman.blog needs to have installed a javascript runtime, if you have node.js or other javascript installed you don’t need to install therubyracer.