- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我在 ubuntu 服务器 14.04 AWS 实例中遇到 Rails 4.1.7、Phusion Passenger 版本 4.0.53、nginx/1.6.2 的问题,但使用 rails 服务器运行良好。
错误日志
App 2029 stdout: App 2029 stderr: sh: 1: App 2029 stderr: env: not found App 2029 stderr: App 2029 stdout: [ 2014-11-12 16:12:26.1580 1979/7feff83f9700 Pool2/Implementation.cpp:287 ]: Could not spawn process for application /home/ubuntu/apps/doger: An error occured while starting up the preloader. Error ID: b7381860 Error details saved to: /tmp/passenger-error-SUjzpL.html Message from application: Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
/var/lib/gems/1.9.1/gems/execjs-2.2.2/lib/execjs/runtimes.rb:51:inautodetect'<br/>
'
/var/lib/gems/1.9.1/gems/execjs-2.2.2/lib/execjs.rb:5:in
/var/lib/gems/1.9.1/gems/execjs-2.2.2/lib/execjs.rb:4:in<top
require' /var/lib/gems/1.9.1/gems/uglifier-2.5.3/lib/uglifier.rb:3:in
(required)>'<br/>
/var/lib/gems/1.9.1/gems/uglifier-2.5.3/lib/uglifier.rb:3:in<top
require'
(required)>'<br/>
/var/lib/gems/1.9.1/gems/bundler-1.7.6/lib/bundler/runtime.rb:76:in
/var/lib/gems/1.9.1/gems/bundler-1.7.6/lib/bundler/runtime.rb:76:inblock (2 levels) in require'<br/>
each'
/var/lib/gems/1.9.1/gems/bundler-1.7.6/lib/bundler/runtime.rb:72:in
/var/lib/gems/1.9.1/gems/bundler-1.7.6/lib/bundler/runtime.rb:72:inblock in require'<br/>
each'
/var/lib/gems/1.9.1/gems/bundler-1.7.6/lib/bundler/runtime.rb:61:in
/var/lib/gems/1.9.1/gems/bundler-1.7.6/lib/bundler/runtime.rb:61:inrequire'<br/>
require' /home/ubuntu/apps/doger/config/application.rb:7:in
/var/lib/gems/1.9.1/gems/bundler-1.7.6/lib/bundler.rb:133:in<top (required)>'
require'
/home/ubuntu/apps/doger/config/environment.rb:2:in
/home/ubuntu/apps/doger/config/environment.rb:2:in<top (required)>'
require' config.ru:3:in
config.ru:3:inblock in <main>'<br/>
instance_eval'
/usr/lib/ruby/vendor_ruby/rack/builder.rb:55:in
/usr/lib/ruby/vendor_ruby/rack/builder.rb:55:ininitialize'<br/>
new' config.ru:1:in
config.ru:1:in<main>'<br/>
eval'
/usr/share/passenger/helper-scripts/rack-preloader.rb:112:in
/usr/share/passenger/helper-scripts/rack-preloader.rb:112:inpreload_app'<br/>
'
/usr/share/passenger/helper-scripts/rack-preloader.rb:158:in
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in<module:PhusionPassenger>'<br/>
'
/usr/share/passenger/helper-scripts/rack-preloader.rb:28:in[ 2014-11-12 16:12:26.1691 1979/7feff60bf700 agents/HelperAgent/RequestHandler.h:2306 ]: [Client 20] Cannot checkout session because a spawning error occurred. The identifier of the error is b7381860. Please see earlier logs for details about the error.
gem 文件
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.7'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
#gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
我已经安装了 nodejs (v0.10.25)
最佳答案
每次设置新的 ubuntu/nginx/passenger/rails 服务器时都会遇到这个问题。试试这个
首先安装 Node :
sudo apt-get install nodejs
然后像这样将你的路径 env 添加到你的/etc/nginx/nginx.conf 中:
环境路径;
或者更具体一点(如果 Node 位于/usr/bin/nodejs):
env PATH=/bin:/usr/bin;
关于ruby-on-rails - 找不到 JavaScript 运行时。有关可用运行时列表,请参阅 https ://github. com/sstephenson/execjs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26891858/
我是一名优秀的程序员,十分优秀!