我在RHEL 6计算机上安装了Rails 4应用程序。
制作使用Passenger和Apache2。
最近我一直试图使用Whenever Gem和Cron将Rake任务整合到生产中作为预定的工作。
每当我尝试在生产中运行其中一个Rake任务时,我会收到以下错误:
rake aborted!
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.
重要的是要提到NodeJS已安装在机器上。我可以预编译资产,等等。
具体来说,命令node --version
会产生:v0.10.31
这是我的堆栈跟踪:
rake aborted!
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.
/var/www/eng_performance/shared/bundle/ruby/2.0.0/gems/execjs-2.2.1/lib/execjs/runtimes.rb:51:in `autodetect'
/var/www/eng_performance/shared/bundle/ruby/2.0.0/gems/execjs-2.2.1/lib/execjs.rb:5:in `<module:ExecJS>'
/var/www/eng_performance/shared/bundle/ruby/2.0.0/gems/execjs-2.2.1/lib/execjs.rb:4:in `<top (required)>'
/var/www/eng_performance/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `require'
/var/www/eng_performance/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `block in require'
/var/www/eng_performance/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:214:in `load_dependency'
/var/www/eng_performance/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `require'
/var/www/eng_performance/shared/bundle/ruby/2.0.0/gems/uglifier-2.5.3/lib/uglifier.rb:3:in `<top (required)>'
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.7.2/lib/bundler/runtime.rb:76:in `require'
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.7.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.7.2/lib/bundler/runtime.rb:72:in `each'
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.7.2/lib/bundler/runtime.rb:72:in `block in require'
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.7.2/lib/bundler/runtime.rb:61:in `each'
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.7.2/lib/bundler/runtime.rb:61:in `require'
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/bundler-1.7.2/lib/bundler.rb:133:in `require'
/var/www/eng_performance/releases/20141014084554/config/application.rb:7:in `<top (required)>'
/var/www/eng_performance/releases/20141014084554/Rakefile:4:in `require'
/var/www/eng_performance/releases/20141014084554/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
注意: 我已经从源代码安装了NodeJS作为编译,因为当我尝试从repo安装时,我得到了这个错误,我不知道如何克服:
Packages skipped because of dependency problems:
c-ares19-1.9.1-5.el6.3.x86_64 from epel
http-parser-2.0-4.20121128gitcd01361.el6.x86_64 from epel
1:libuv-0.10.28-1.el6.x86_64 from epel
nodejs-0.10.30-1.el6.x86_64 from epel
1:v8-3.14.5.10-11.el6.x86_64 from epel
答案 0 :(得分:4)
好吧,最后,我能够解决这个问题:)
事实证明,node.js的安装没有任何问题,但是引用了它。
我不知道为什么这首先被改变了,但following this post解决了问题 - 即添加了符号链接ln -s /usr/local/bin/node /usr/bin/node
。
注意:我非常确定符号链接不是最佳做法。如果有人可以提出另一个想法 - 我很乐意听到它......
希望这是我用node.js得到的最后一个错误。 如果发生此类其他错误,therubyracer将提供出色的备份解决方案。