简体   繁体   中英

Can’t start middleman server

I Installed middlemanapp , and after trying to start a local server was asked to install bundle . I installed it and all was well.

This is my Gemfile:

source 'https://rubygems.org’
gem 'nokogiri’
gem ‘rack’, '~> 2.0.1’
gem ‘rspec’

And when I enter middleman server I get the following error:

Please report a bug if this causes problems.
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/middleman-cli-4.2.1/bin/middleman:12:in require': cannot load such file -- dotenv (LoadError) from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/middleman-cli-4.2.1/bin/middleman:12:in<top (required)>'
from C:/Ruby24-x64/bin/middleman:23:in load' from C:/Ruby24-x64/bin/middleman:23:in’

What shall I do?

You have to add middleman to your Gemfile:

source 'https://rubygems.org'

ruby '2.4.2'

# For faster file watcher updates on Windows:
gem 'wdm', '~> 0.1.1', platforms: [:mswin, :mingw]

# windows does not come with time zone data
gem 'tzinfo-data', platforms: [:mswin, :mingw]

# Middleman Gems
gem 'middleman', '~> 4.2', '>= 4.2.1'
gem 'middleman-livereload'

# Your Gems
gem 'nokogiri', '~> 1.8', '>= 1.8.1'
gem 'rack', '~> 2.0', '>= 2.0.3'

# Development
group :development, :test do
  gem 'rspec', '~> 3.7'
end

and run:

bundle install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM