admin管理员组

文章数量:1425793

I have installed nodejs on ubuntu 12.04 server and I want to know why I have problems when piling assets, when I go to the console rails c I run this

ExecJS::Runtimes.best_available=> #<ExecJS::ExternalRuntime:0x0000000118cc88
@binary="nodejs",
@mand=["nodejs", "node"],
@deprecated=false,
@encoding="UTF-8",
@name="Node.js (V8)",
@runner_path= "/home/bonsai/.rvm/gems/[email protected]/gems/execjs-1.4.0/lib/execjs/support/node_runner.js",

@test_args=nil, @test_match=nil>

And of course I can run node or nodejs mands, what can be wrong, this is the error after trying to pile assets

/home/bonsai/.rvm/rubies/ruby-1.9.3-p392/bin/ruby /home/bonsai/.rvm/gems/ruby-1.9.3-p392@global/bin/rake assets:prepile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Killed

  (in /home/bonsai/bonsaierp/app/assets/javascripts/application.js.coffee)
/home/bonsai/.rvm/gems/[email protected]/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:142:in `exec_runtime'
/home/bonsai/.rvm/gems/[email protected]/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:28:in `block in exec'
/home/bonsai/.rvm/gems/[email protected]/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:41:in `pile_to_tempfile'
/home/bonsai/.rvm/gems/[email protected]/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:27:in `exec'
/home/bonsai/.rvm/gems/[email protected]/gems/uglifier-1.3.0/lib/uglifier.rb:100:in `pile'
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/pressors.rb:74:in `press'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/processing.rb:265:in `block in js_pressor='
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/processor.rb:29:in `call'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/processor.rb:29:in `evaluate'
/home/bonsai/.rvm/gems/[email protected]/gems/tilt-1.3.6/lib/tilt/template.rb:77:in `render'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/context.rb:193:in `block in evaluate'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `each'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `evaluate'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/bundled_asset.rb:26:in `initialize'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `new'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `build_asset'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/index.rb:93:in `block in build_asset'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/caching.rb:19:in `cache_asset'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/index.rb:92:in `build_asset'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:169:in `find_asset'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/index.rb:60:in `find_asset'
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/static_piler.rb:19:in `block in pile'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:219:in `block in each_logical_path'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:206:in `block (2 levels) in each_file'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each_entry'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:204:in `block in each_file'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each_file'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:217:in `each_logical_path'
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/static_piler.rb:18:in `pile'
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:56:in `internal_prepile'
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:70:in `block (3 levels) in <top (required)>'
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
Tasks: TOP => assets:prepile:primary
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/home/bonsai/.rvm/rubies/ruby-1.9.3-p392/b...]
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/home/bonsai/.rvm/gems/[email protected]/bin/ruby_noexec_wrapper:14:in `eval'
/home/bonsai/.rvm/gems/[email protected]/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => assets:prepile
(See full trace by running task with --trace)

I have installed nodejs on ubuntu 12.04 server and I want to know why I have problems when piling assets, when I go to the console rails c I run this

ExecJS::Runtimes.best_available=> #<ExecJS::ExternalRuntime:0x0000000118cc88
@binary="nodejs",
@mand=["nodejs", "node"],
@deprecated=false,
@encoding="UTF-8",
@name="Node.js (V8)",
@runner_path= "/home/bonsai/.rvm/gems/[email protected]/gems/execjs-1.4.0/lib/execjs/support/node_runner.js",

@test_args=nil, @test_match=nil>

And of course I can run node or nodejs mands, what can be wrong, this is the error after trying to pile assets

/home/bonsai/.rvm/rubies/ruby-1.9.3-p392/bin/ruby /home/bonsai/.rvm/gems/ruby-1.9.3-p392@global/bin/rake assets:prepile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Killed

  (in /home/bonsai/bonsaierp/app/assets/javascripts/application.js.coffee)
/home/bonsai/.rvm/gems/[email protected]/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:142:in `exec_runtime'
/home/bonsai/.rvm/gems/[email protected]/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:28:in `block in exec'
/home/bonsai/.rvm/gems/[email protected]/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:41:in `pile_to_tempfile'
/home/bonsai/.rvm/gems/[email protected]/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:27:in `exec'
/home/bonsai/.rvm/gems/[email protected]/gems/uglifier-1.3.0/lib/uglifier.rb:100:in `pile'
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/pressors.rb:74:in `press'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/processing.rb:265:in `block in js_pressor='
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/processor.rb:29:in `call'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/processor.rb:29:in `evaluate'
/home/bonsai/.rvm/gems/[email protected]/gems/tilt-1.3.6/lib/tilt/template.rb:77:in `render'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/context.rb:193:in `block in evaluate'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `each'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/context.rb:190:in `evaluate'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/bundled_asset.rb:26:in `initialize'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `new'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:252:in `build_asset'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/index.rb:93:in `block in build_asset'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/caching.rb:19:in `cache_asset'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/index.rb:92:in `build_asset'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:169:in `find_asset'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/index.rb:60:in `find_asset'
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/static_piler.rb:19:in `block in pile'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:219:in `block in each_logical_path'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:206:in `block (2 levels) in each_file'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:196:in `each_entry'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:204:in `block in each_file'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:203:in `each_file'
/home/bonsai/.rvm/gems/[email protected]/gems/sprockets-2.2.2/lib/sprockets/base.rb:217:in `each_logical_path'
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/static_piler.rb:18:in `pile'
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:56:in `internal_prepile'
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:70:in `block (3 levels) in <top (required)>'
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
Tasks: TOP => assets:prepile:primary
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/home/bonsai/.rvm/rubies/ruby-1.9.3-p392/b...]
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/home/bonsai/.rvm/gems/[email protected]/gems/actionpack-3.2.13/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/home/bonsai/.rvm/gems/[email protected]/bin/ruby_noexec_wrapper:14:in `eval'
/home/bonsai/.rvm/gems/[email protected]/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => assets:prepile
(See full trace by running task with --trace)
Share Improve this question asked Mar 21, 2013 at 16:12 Boris BarrosoBoris Barroso 1,8122 gold badges23 silver badges42 bronze badges 2
  • Almost same error here, did you find a solution? – Darme Commented Jun 14, 2013 at 23:29
  • No I could not, I had this error while using digitalocean. hosting but with other hosting the error did not came up – Boris Barroso Commented Jun 15, 2013 at 15:39
Add a ment  | 

2 Answers 2

Reset to default 6

I had the same issue, also when I was using Digital Ocean. I assume you're using the 512MB droplet. I sent them a support ticket and this was their reply:

"Generally, running Nginx, Unicorn, and Ruby on Rails on a 512MB droplet, you will run into memory issues. I would remend considering to upgrade to a 1GB droplet, as well as set up 1GB of swap memory."

Note that I still tried to set up a 1 GB swap memory while using the 512MB droplet, since I had no swap memory set up on the server, but this actually produced the same error. When I followed his/her advice and upgraded to the 1GB droplet, piling assets worked fine.

You should create a swap file. This will create some virtual memory from storage (Digital Ocean droplets use SSDs so it should be relatively fast).

Create a 1GB swap file, set read/write permissions for root only, then enable it [1].

sudo dd if=/dev/zero of=/swapfile bs=1M count=1024
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

To make the swap permanent add the following line to the end of your /etc/fstab

/swapfile   none    swap    sw    0   0

I also highly remend following this tutorial provided by Digital Ocean to optimize your Unicorn workers. https://www.digitalocean./munity/tutorials/how-to-optimize-unicorn-workers-in-a-ruby-on-rails-app


Im currently running two Rails websites with Unicorn and Nginx with this setup and haven't had any more issues like this.

  1. https://www.digitalocean./munity/tutorials/how-to-add-swap-on-ubuntu-14-04

本文标签: javascriptExecJS runtime errorStack Overflow