“无法找到JavaScript运行时。”在执行refinerycms命令期间

时间:2012-10-24 00:43:43

标签: refinerycms

我正在研究Ubuntu 12.04。

我正在尝试使用Refinery CMS创建一个新网站。 我读了the official Getting Started guide,并执行了以下命令。

$ refinerycms rickrockstar

但是我收到以下错误消息:

Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
        rake db:create
rake aborted!
Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.

(See full trace by running task with --trace)
    generate refinery:cms --fresh-installation
/home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>'
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/execjs-1.4.0/lib/execjs.rb:4:in `<top (required)>'
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `<top (required)>'
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `<top (required)>'
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `<top (required)>'
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `each'
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `block in require'
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `each'
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `require'
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.2.1/lib/bundler.rb:128:in `require'
        from /srv/samba/share/refinery2test/rickrockstar/config/application.rb:13:in `<top (required)>'
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.8/lib/rails/commands.rb:24:in `require'
        from /home/jharai/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.8/lib/rails/commands.rb:24:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

我已将the entire output粘贴在Gist上,因为它太长了。

奇怪的是,几天前我尝试过同样的命令,当时一切正常。

为什么会这样?我该如何解决?

2 个答案:

答案 0 :(得分:0)

也许你可以sudo apt-get install nodejs或看到这篇文章ExecJS and could not find a JavaScript runtime

答案 1 :(得分:0)

为了解决这个问题,我做了:

  • 运行 refinerycms rickrockstar - 它会因您描述的异常而失败
  • 修改rickrockstar/Gemfile并取消注释*gem 'therubyracer', :platforms => :ruby*并保存更改;
  • 再次运行 refinerycms rickrockstar
  • Gemfile会发生冲突并询问您是否要覆盖它。回答否;
  • 覆盖其他有冲突的文件
  • cd rickrockstar
  • rails s