让我用步骤和简短的例子解释我的问题:
第1步:创建新项目:
rails new Project
Step2:创建一个控制器:
rails generate controller Pages home contact
第3步:启动我的服务器:
rails s
Step4:请求网址:localhost:8000 / pages / home
无限循环的字符开始了!过了一会儿它会显示:
js: "/tmp/execjs20120131-2808-a2gs3e.js", line 508: il manque '}' après le corps d'une fonction
js: });
js: ..^
(in /home/Projet/app/assets/javascripts/pages.js.coffee)):
3: <head>
4: <title>ProjetTest2</title>
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
9: <body>
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___588914926_92363960'
提前致谢
答案 0 :(得分:0)
这对你有用吗?
$ rails console
Loading development environment (Rails 3.2.0)
ruby-1.9.2-p290 :001 > ExecJS::Runtimes.autodetect
=> #<ExecJS::ExternalRuntime:0x00000101100048 @name="JavaScriptCore", @command="/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc", @runner_path="/Users/mattias/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.3.0/lib/execjs/support/jsc_runner.js", @test_args=nil, @test_match=nil, @encoding=nil, @binary="/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc">
ruby-1.9.2-p290 :001 > CoffeeScript.compile(open("app/assets/javascripts/pages.js.coffee").read)
=> "(function() {\n\n\n\n}).call(this);\n"
ruby-1.9.2-p290 :002 >
答案 1 :(得分:0)
最后我找到了解决方案。我刚刚安装了nodejs:
sudo apt-get install nodejs
以及以下宝石: therubyracer,execjs,野马