我尝试用 ruby(css、js 等)构建一个主题,但我有一个错误,我花了几个小时试图解决它并阅读文档,但没有成功。
这是我在执行以下操作时遇到的错误: bundle exec middleman build --verbose
== Request: /pages/forms/forms.html
error build/pages/forms/forms.html
can't convert nil into String
/var/lib/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/core_ext/string/output_safety.rb:114:in `concat'
/var/lib/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/core_ext/string/output_safety.rb:114:in `safe_concat'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-more/core_extensions/default_helpers.rb:63:in `block in content_tag'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-more/core_extensions/default_helpers.rb:63:in `each'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-more/core_extensions/default_helpers.rb:63:in `content_tag'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/tag_helpers.rb:140:in `safe_content_tag'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/form_helpers.rb:646:in `select_tag'
/home/polylan/Documents/dev/core-admin-release/source/pages/forms/forms.html.erb:60:in `block in singletonclass'
/home/polylan/Documents/dev/core-admin-release/source/pages/forms/forms.html.erb:65530:in `instance_eval'
/home/polylan/Documents/dev/core-admin-release/source/pages/forms/forms.html.erb:65530:in `singletonclass'
/home/polylan/Documents/dev/core-admin-release/source/pages/forms/forms.html.erb:65528:in `__tilt_16623600'
/var/lib/gems/1.9.1/gems/tilt-1.3.7/lib/tilt/template.rb:144:in `call'
/var/lib/gems/1.9.1/gems/tilt-1.3.7/lib/tilt/template.rb:144:in `evaluate'
/var/lib/gems/1.9.1/gems/tilt-1.3.7/lib/tilt/template.rb:77:in `render'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/core_extensions/rendering.rb:273:in `render_individual_file'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/core_extensions/rendering.rb:150:in `render_template'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/sitemap/resource.rb:150:in `block in render'
/var/lib/gems/1.9.1/gems/activesupport-3.2.14/lib/active_support/notifications.rb:125:in `instrument'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/util.rb:60:in `instrument'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/application.rb:196:in `instrument'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/sitemap/resource.rb:16:in `instrument'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/sitemap/resource.rb:121:in `render'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/core_extensions/request.rb:252:in `process_request'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/core_extensions/request.rb:202:in `block in call!'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/core_extensions/request.rb:201:in `catch'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/core_extensions/request.rb:201:in `call!'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/core_extensions/request.rb:187:in `call'
/var/lib/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:138:in `call'
/var/lib/gems/1.9.1/gems/rack-1.5.2/lib/rack/urlmap.rb:65:in `block in call'
/var/lib/gems/1.9.1/gems/rack-1.5.2/lib/rack/urlmap.rb:50:in `each'
/var/lib/gems/1.9.1/gems/rack-1.5.2/lib/rack/urlmap.rb:50:in `call'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-more/extensions/minify_css.rb:48:in `call'
/var/lib/gems/1.9.1/gems/rack-1.5.2/lib/rack/lint.rb:49:in `_call'
/var/lib/gems/1.9.1/gems/rack-1.5.2/lib/rack/lint.rb:37:in `call'
/var/lib/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:138:in `call'
/var/lib/gems/1.9.1/gems/rack-test-0.6.2/lib/rack/mock_session.rb:30:in `request'
/var/lib/gems/1.9.1/gems/rack-test-0.6.2/lib/rack/test.rb:230:in `process_request'
/var/lib/gems/1.9.1/gems/rack-test-0.6.2/lib/rack/test.rb:57:in `get'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/cli/build.rb:138:in `render_to_file'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/cli/build.rb:280:in `block in execute!'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/cli/build.rb:277:in `each'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/cli/build.rb:277:in `execute!'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/cli/build.rb:199:in `invoke!'
/var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/actions.rb:95:in `action'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/cli/build.rb:64:in `build'
/var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
/var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
/var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
/var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/cli.rb:77:in `method_missing'
/var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:29:in `run'
/var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:128:in `run'
/var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
/var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
/var/lib/gems/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/lib/middleman-core/cli.rb:22:in `start'
/var/lib/gems/1.9.1/gems/middleman-core-3.1.4/bin/middleman:18:in `<top (required)>'
/usr/local/bin/middleman:23:in `load'
/usr/local/bin/middleman:23:in `<main>'
这是结果:捆绑安装
Using i18n (0.6.5)
Using multi_json (1.7.9)
Using activesupport (3.2.14)
Using chunky_png (1.2.8)
Using coffee-script-source (1.6.3)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using fssm (0.2.10)
Using sass (3.2.10)
Using compass (0.12.2)
Using ffi (1.9.0)
Using tilt (1.3.7)
Using haml (4.0.3)
Using hike (1.2.3)
Using json (1.7.7)
Using kramdown (1.1.0)
Using rb-fsevent (0.9.3)
Using rb-inotify (0.9.1)
Using rb-kqueue (0.2.0)
Using listen (1.2.3)
Using bundler (1.3.5)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using thor (0.18.1)
Using middleman-core (3.1.4)
Using middleman-more (3.1.4)
Using sprockets (2.10.0)
Using sprockets-helpers (1.0.1)
Using sprockets-sass (1.0.1)
Using middleman-sprockets (3.1.4)
Using uglifier (2.1.2)
Using middleman (3.1.4)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
我的宝石文件
source 'http://rubygems.org'
gem "middleman", "~>3.1.4"
# Live-reloading plugin
gem "middleman-livereload", "~> 3.1.0"
gem 'json', '~> 1.7.7'
gem 'therubyracer'
if RUBY_PLATFORM =~ /linux/i
gem 'rb-inotify', '~> 0.9'
else
gem 'rb-inotify'
end
我使用: ruby 1.9.1 ruby1.9.1-dev 中间人(最新版本) nodejs therubyracer execjs
更新 1:
感谢 j03w 评论,错误看起来确实是 forms.html.erb 中的这部分代码
<li>
<label>Dropdown with search:</label>
<%= select_tag :colors, options: @colorList.shuffle, class: "chzn-select" %>
</li>
<li>
<label>Dropdown menu:</label>
<%= select_tag :colors, options: @colorList.shuffle, class: "uniform" %>
</li>
这是我的 config.rb 的一部分,其中数组是:
@release = false
@colorList = ["Aero blue","Air Force blue (RAF)","Air Force blue (USAF)","Air superiority blue","Alabama Crimson","Alice blue","Alizarin crimson","Alloy orange","Almond","Amaranth","Amazon","Amber",
"SAE/ECE Amber (color)","American rose","Amethyst","Android Green","Anti-flash white","Antique brass","Antique bronze","Antique fuchsia "]
如果您需要更多信息,请随时询问。
如果您遇到同样的问题或对该错误有任何想法,我们将不胜感激。
提前致谢。
扬