我在 Ubuntu 11.04 64 位上运行 Ruby 1.9.2p180。
我有使用Sinatra的最简单的CoffeeScript示例,它运行良好,但在我按下快捷方式时不会停止。所以每次我必须这样做,它变得非常乏味。Ctrl+C
kill -9
app.rb
: _
require 'sinatra'
require 'coffee-script'
get '/' do
'<script src="/app.js" type="text/javascript"></script>'
end
get '/app.js' do
coffee :app
end
views/app.coffee
: _
alert 'Foo'
它在 Ruby 1.8.7 上工作,稍作修改:
require 'rubygems'
require 'sinatra'
require 'coffee-script'
require 'json'
get '/' do
'<script src="/app.js" type="text/javascript"></script>'
end
get '/app.js' do
coffee :app
end
当我删除 line 时,它也适用require 'coffee-script'
于 1.9.2 ,但给了我一个警告:
WARN: tilt autoloading 'coffee_script' in a non thread-safe way; explicit require 'coffee_script' suggested.
发现它在使用时可以工作therubyracer
,但在node
. 来自 Ubuntu 10.10 存储库的 0.1.97 版本是唯一的例外。当使用 Natty 的 0.2.6 时,它会失败,并且在使用 nvm 安装最新的(0.4.8)时,我无法通过 nvm 安装 0.1.97。