3

我有:

$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
$ middleman version
Middleman 2.0.13.1
$ cat /etc/debian_version 
6.0.3

如果我像这样开始一个项目:

$ 中间人初始化 np --rack --bundler --template=html5
      创建 np/config.ru
      创建 np/Gemfile
         运行捆绑安装
获取 http://rubygems.org/ 的源索引
使用 multi_json (1.0.3)
使用 activesupport (3.1.1)
使用可寻址(2.2.6)
使用 chunky_png (1.2.5)
使用咖啡脚本源 (1.1.2)
使用 execjs (1.2.9)
使用咖啡脚本(2.2.0)
使用 fssm (0.2.7)
使用 sass (3.1.10)
使用指南针 (0.11.5)
使用守护进程 (1.1.4)
使用事件机(0.12.10)
使用 em-websocket (0.3.3)
使用雷神 (0.14.6)
使用警卫(0.6.3)
使用guard-livereload (0.3.1)
使用haml (3.1.3)
使用远足 (1.2.1)
使用机架 (1.3.5)
使用 url_mount (0.2.1)
使用 http_router (0.10.2)
使用 i18n (0.6.0)
使用语法 (1.0.0)
使用 maruku (0.6.0)
使用中间人-livereload (0.2.1)
使用机架保护 (1.1.4)
使用倾斜 (1.3.3)
使用 sinatra (1.3.1)
使用 padrino-core (0.10.5)
使用 padrino-helpers (0.10.5)
使用机架测试(0.6.1)
使用寺庙 (0.3.4)
使用苗条(1.0.3)
使用链轮 (2.0.3)
使用薄 (1.2.11)
使用 uglifier (1.0.4)
使用中间人 (2.0.13.1)
使用捆绑器 (1.0.21)
您的捆绑包已完成!使用 `bundle show [gemname]` 查看捆绑的 gem 的安装位置。
      创建 np/config.rb
      创建 np/源
      创建 np/source/404.html
      创建 np/source/README.md
      创建 np/source/apple-touch-icon-114x114-precomposed.png
      创建 np/source/apple-touch-icon-57x57-precomposed.png
      创建 np/source/apple-touch-icon-72x72-precomposed.png
      创建 np/source/apple-touch-icon-precomposed.png
      创建 np/source/apple-touch-icon.png
      创建 np/source/crossdomain.xml
      创建 np/source/css/style.css
      创建 np/source/favicon.ico
      创建 np/source/humans.txt
      创建 np/source/img/.gitignore
      创建 np/source/index.html
      创建 np/source/js/libs/jquery-1.6.2.js
      创建 np/source/js/libs/jquery-1.6.2.min.js
      创建 np/source/js/libs/modernizr-2.0.6.min.js
      创建 np/source/js/mylibs/.gitignore
      创建 np/source/js/plugins.js
      创建 np/source/js/script.js
      创建 np/source/robots.txt
      创建 np/source/test/index.html
      创建 np/source/test/qunit/qunit.css
      创建 np/source/test/qunit/qunit.js
      创建 np/source/test/tests.js
       存在 np/源

并进入目录以运行预览:

$ cd np/
$ 中间人服务器
请安装 rb-inotify gem 以获得 Linux inotify 支持
使用轮询(请帮助我们更好地支持您的系统。)
使用内联 Guardfile。
Guard 现在在 '/tmp/np' 观看
/home/blt/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.9/lib/execjs/runtimes.rb:47:在“自动检测”中:找不到 JavaScript 运行时。有关可用运行时的列表,请参阅 https://github.com/sstephenson/execjs。(ExecJS::RuntimeUnavailable)
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.9/lib/execjs.rb:5:in `'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.9/lib/execjs.rb:4:in `'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `'
    来自/home/blt/.rvm/gems/ruby-1.9.2-p290/gems/middleman-2.0.13.1/lib/middleman/renderers/coffee_script.rb:4:in `require'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/middleman-2.0.13.1/lib/middleman/renderers/coffee_script.rb:4:in `registered'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/sinatra-1.3.1/lib/sinatra/base.rb:1262:in `block in register'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/sinatra-1.3.1/lib/sinatra/base.rb:1260:in `each'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/sinatra-1.3.1/lib/sinatra/base.rb:1260:in `register'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/middleman-2.0.13.1/lib/middleman/core_extensions/rendering.rb:14:in `registered'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/sinatra-1.3.1/lib/sinatra/base.rb:1262:in `block in register'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/sinatra-1.3.1/lib/sinatra/base.rb:1260:in `each'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/sinatra-1.3.1/lib/sinatra/base.rb:1260:in `register'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/middleman-2.0.13.1/lib/middleman/base.rb:54:in `registered'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/sinatra-1.3.1/lib/sinatra/base.rb:1262:in `block in register'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/sinatra-1.3.1/lib/sinatra/base.rb:1260:in `each'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/sinatra-1.3.1/lib/sinatra/base.rb:1260:in `register'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/middleman-2.0.13.1/lib/middleman.rb:180:in `server'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/middleman-2.0.13.1/lib/middleman.rb:191:in `start_server'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/middleman-2.0.13.1/lib/middleman/guard.rb:58:in `block in server_start'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/middleman-2.0.13.1/lib/middleman/guard.rb:57:in `fork'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/middleman-2.0.13.1/lib/middleman/guard.rb:57:in `server_start'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/middleman-2.0.13.1/lib/middleman/guard.rb:47:in `start'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/guard-0.6.3/lib/guard.rb:66:in `supervised_task'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/guard-0.6.3/lib/guard.rb:43:in `block in start'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/guard-0.6.3/lib/guard.rb:43:in `each'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/guard-0.6.3/lib/guard.rb:43:in `start'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/middleman-2.0.13.1/lib/middleman/guard.rb:34:in `start'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/middleman-2.0.13.1/lib/middleman/cli.rb:55:in `server'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/middleman-2.0.13.1/bin/middleman:52:in `start_cli!'
    来自/home/blt/.rvm/gems/ruby-1.9.2-p290/gems/middleman-2.0.13.1/bin/middleman:47:in `did_locate_middleman_project'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/middleman-2.0.13.1/bin/middleman:20:in `locate_middleman_root!'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/gems/middleman-2.0.13.1/bin/middleman:70:in `'
    来自/home/blt/.rvm/gems/ruby-1.9.2-p290/bin/middleman:19:in `load'
    来自 /home/blt/.rvm/gems/ruby-1.9.2-p290/bin/middleman:19:in `'
再见...

尽管那样:

$ 宝石清单 | grep 赛车手
therubyracer (0.9.8)

$ 宝石清单 | grep inotify
rb-inotify (0.8.8)

我遵循了 RVM Installation Guide和 Middleman Getting Started。任何想法为什么 Middleman 无法启动服务器?

4

3 回答 3

5

似乎middleman server用户只是基于 Gemfile 的沙箱。如果您已在全局范围内安装了 gem,它们将不会在运行时出现在沙箱中。创建的原始 Gemfilemiddleman init如下所示:

source "http://rubygems.org"
gem "middleman", "~>2.0.13.1"

将其编辑为:

source "http://rubygems.org"

gem "middleman", "~>2.0.13.1"
gem "rb-inotify"
gem "therubyracer"

如果您愿意,您可以不那么懒惰并通过操作系统对其进行参数化。

于 2011-10-22T14:54:02.380 回答
0

如果您删除 Gemfile.lock 文件,然后在您的根目录中运行

捆绑安装 --binstubs ./bin --path 供应商/捆绑

该捆绑包将在本地安装所有软件包(以及所有在 ./bin 中启动的可执行文件)

如果有帮助,您也可以尝试我的模板以开始使用

http://github.com/vladp/middleman-Simple-Site

于 2014-01-26T02:57:39.823 回答
-1

这是你需要注意的线

/home/blt/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.9/lib/execjs/runtimes.rb:47:在“自动检测”中:找不到 JavaScript 运行时。有关可用运行时的列表,请参阅https://github.com/sstephenson/execjs。(ExecJS::RuntimeUnavailable)

基本上你需要在你的系统上安装一个 js 运行时,比如 node js 或 v8 或其他东西,以便 execjs 可以使用它。仔细阅读本文

于 2011-10-22T14:06:54.947 回答