2011-12-04 14 views
1

私はRuby on Railを初めて使用しています。私は最終的にubuntu 11にレールをインストールするのに成功し、 "rails new myapp"でアプリを作成しました。私が間違っていたかもしれないもののために無知だrails generate model:エラー

:私は次のエラーを取得しています

しかしでモデルを生成しながら、「::文字列USER_COMMENTテキストバンドル幹部レールがモデルコメントユーザーを生成します」。あなたはランタイムのそのリストから選択する必要が

/home/pratuat/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.9/lib/execjs/runtimes.rb:47:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable) 
    from /home/pratuat/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.9/lib/execjs.rb:5:in `' 
    from /home/pratuat/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.9/lib/execjs.rb:4:in `' 
    from /home/pratuat/.rvm/gems/ruby-1.9.2-p290/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require' 
    from /home/pratuat/.rvm/gems/ruby-1.9.2-p290/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `' 
    from /home/pratuat/.rvm/gems/ruby-1.9.2-p290/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require' 
    from /home/pratuat/.rvm/gems/ruby-1.9.2-p290/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `' 
    from /home/pratuat/.rvm/gems/ruby-1.9.2-p290/gems/coffee-rails-3.1.1/lib/coffee-rails.rb:1:in `require' 
    from /home/pratuat/.rvm/gems/ruby-1.9.2-p290/gems/coffee-rails-3.1.1/lib/coffee-rails.rb:1:in `' 
    from /home/pratuat/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require' 
    from /home/pratuat/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require' 
    from /home/pratuat/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each' 
    from /home/pratuat/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require' 
    from /home/pratuat/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each' 
    from /home/pratuat/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require' 
    from /home/pratuat/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler.rb:122:in `require' 
    from /home/pratuat/Documents/rails/railsdemo/config/application.rb:7:in `' 
    from /home/pratuat/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/commands.rb:21:in `require' 
    from /home/pratuat/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/commands.rb:21:in `' 
    from script/rails:6:in `require' 
    from script/rails:6:in `'
+0

[Rails 3.1のエラー - JavaScriptランタイムが見つかりませんでしたか?](http://stackoverflow.com/questions/7092107/rails-3-1-error-could-not-find-a-javascript-ランタイム) –

答えて

4

https://github.com/sstephenson/execjs

。私が見つけた最も簡単なのはtherabyracerです。これをあなたのGemfileに加えてから、bundle installを実行してください。

gem "therubyracer" 

その後、モデルジェネレータが機能するはずです。

+0

また、** node.js **または** gem 'execjs ** **がubuntuにインストールされている必要があります。 – pratuat

+0

node.jsをインストールした場合、新しいアプリケーション用にこれを実行する必要はありません。これは、javascriptランタイムとしてレールによって選択されます。 – Aras

関連する問題