Could not find a JavaScript runtime.

作者: 云中布衣   分类:  操作系统    热度: (743℃)   时间: 2015-10-15 2:05   标签: #ruby  #gem  #rails    

Could not find a JavaScript runtime.

报错详情:

billcode@billcode-y470:~/github/course/rottenpotatoes-rails-intro$ bundle exec rake db:create db:migrate
rake aborted!
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. 
See https://github.com/rails/execjs for a list of available runtimes.
/home/billcode/.rvm/gems/ruby-2.2.2/gems/execjs-2.5.2/lib/execjs/runtimes.rb:48:in `autodetect'
/home/billcode/.rvm/gems/ruby-2.2.2/gems/execjs-2.5.2/lib/execjs.rb:5:in `<module:ExecJS>'
/home/billcode/.rvm/gems/ruby-2.2.2/gems/execjs-2.5.2/lib/execjs.rb:4:in `<top (required)>'
/home/billcode/.rvm/gems/ruby-2.2.2/gems/uglifier-2.7.1/lib/uglifier.rb:3:in `require'
/home/billcode/.rvm/gems/ruby-2.2.2/gems/uglifier-2.7.1/lib/uglifier.rb:3:in `<top (required)>'
/home/billcode/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
/home/billcode/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/home/billcode/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
/home/billcode/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
/home/billcode/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
/home/billcode/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
/home/billcode/.rvm/gems/ruby-2.2.2/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
/home/billcode/github/course/rottenpotatoes-rails-intro/config/application.rb:7:in `<top (required)>'
/home/billcode/github/course/rottenpotatoes-rails-intro/Rakefile:4:in `require'
/home/billcode/github/course/rottenpotatoes-rails-intro/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

解决方案:

在系统直接装Execjs

 $ gem install execjs

或Node.js.

   wget http://nodejs.org/dist/node-v0.6.9.tar.gz  
   tar zxvf node-v0.6.9.tar.gz  
   cd node-v0.6.9  
   ./configure --prefix=/usr/local/node  
   make  
   make install  

或在Gemfile里面加入

   gem 'therubyracer'
   gem 'execjs'

(完)

56.8K

发表评论:

© 云中布衣 2015 | Driven by EMLOG  | SiteMap | RunTime: 10.13ms&RSS  | MORE  |   | TOP

文章数量【258】 评论数量【238】 稳定运行【1210天】

Visitor IP Address【54.82.73.21】

Email:ieeflsyu#outlook.com