https://github.com/rails/execjs
Run JavaScript code from Ruby
https://github.com/rails/execjs
Keywords from Contributors
rubygems activerecord mvc activejob rack ruby-gem sinatra rspec background-jobs libxml2
Last synced: about 21 hours ago
JSON representation
Repository metadata
Run JavaScript code from Ruby
- Host: GitHub
- URL: https://github.com/rails/execjs
- Owner: rails
- License: mit
- Created: 2015-03-12T21:55:53.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2025-06-13T06:43:40.000Z (9 months ago)
- Last Synced: 2026-02-13T23:31:34.585Z (17 days ago)
- Language: Ruby
- Homepage:
- Size: 861 KB
- Stars: 554
- Watchers: 25
- Forks: 289
- Open Issues: 29
- Releases: 5
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: MIT-LICENSE
README.md
ExecJS
ExecJS lets you run JavaScript code from Ruby. It automatically picks
the best runtime available to evaluate your JavaScript program, then
returns the result to you as a Ruby object.
ExecJS supports these runtimes:
- therubyrhino - Mozilla
Rhino embedded within JRuby - Duktape.rb - Duktape JavaScript interpreter
- Node.js
- Bun.sh - JavaScript runtime & toolkit designed for speed
- Apple JavaScriptCore - Included with Mac OS X
- Microsoft Windows Script Host (JScript)
- Google V8
- mini_racer - Google V8
embedded within Ruby - GraalVM JavaScript - used on TruffleRuby
A short example:
require "execjs"
ExecJS.eval "'red yellow blue'.split(' ')"
# => ["red", "yellow", "blue"]
A longer example, demonstrating how to invoke the CoffeeScript compiler:
require "execjs"
require "net/http"
source = Net::HTTP.get(URI("https://coffeescript.org/browser-compiler-legacy/coffeescript.js"))
context = ExecJS.compile(source)
context.call("CoffeeScript.compile", "square = (x) -> x * x", bare: true)
# => "var square;\nsquare = function(x) {\n return x * x;\n};"
Forcing a specific runtime
If you'd like to use a specific runtime rather than the autodetected one, you can assign ExecJS.runtime:
ExecJS.runtime = ExecJS::Runtimes::Node
Alternatively, you can define it via the EXECJS_RUNTIME environment variable:
EXECJS_RUNTIME=Node ruby ...
You can find the list of possible runtimes in lib/execjs/runtimes.rb.
Installation
$ gem install execjs
FAQ
Why can't I use CommonJS require() inside ExecJS?
ExecJS provides the lowest common denominator interface to any JavaScript runtime.
Use ExecJS when it doesn't matter which JavaScript interpreter your code runs
in. If you want to access the Node API, you should check another library like
commonjs.rb designed to provide a
consistent interface.
Why can't I use setTimeout?
For similar reasons as modules, not all runtimes guarantee a full JavaScript
event loop. So setTimeout, setInterval and other timers are not defined.
Why can't I use ES5 features?
Some runtimes like Node will implement many of the latest ES5 features. However
older stock runtimes like JSC on OSX and JScript on Windows may not. You should
only count on ES3 features being available. Prefer feature checking these APIs
rather than hard coding support for specific runtimes.
Can ExecJS be used to sandbox scripts?
No, ExecJS shouldn't be used for any security related sandboxing. Since runtimes
are automatically detected, each runtime has different sandboxing properties.
You shouldn't use ExecJS.eval on any inputs you wouldn't feel comfortable Ruby
eval()ing.
Contributing to ExecJS
ExecJS is the work of dozens of contributors. You're encouraged to submit pull requests, propose
features and discuss issues.
See CONTRIBUTING.
License
ExecJS is released under the MIT License.
Owner metadata
- Name: Ruby on Rails
- Login: rails
- Email:
- Kind: organization
- Description:
- Website: https://rubyonrails.org/
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/4223?v=4
- Repositories: 116
- Last ynced at: 2023-04-09T03:40:20.529Z
- Profile URL: https://github.com/rails
GitHub Events
Total
- Pull request event: 2
- Fork event: 3
- Issues event: 2
- Watch event: 18
- Issue comment event: 7
- Push event: 1
- Create event: 1
Last Year
- Pull request event: 2
- Fork event: 2
- Watch event: 13
- Issue comment event: 1
Committers metadata
Last synced: 2 days ago
Total Commits: 414
Total Committers: 58
Avg Commits per committer: 7.138
Development Distribution Score (DDS): 0.449
Commits in past year: 1
Committers in past year: 1
Avg Commits per committer in past year: 1.0
Development Distribution Score (DDS) in past year: 0.0
| Name | Commits | |
|---|---|---|
| Joshua Peek | j****h@j****m | 228 |
| Sam Stephenson | s****m@3****m | 47 |
| Jean Boussier | j****r@g****m | 23 |
| Benoit Daloze | e****p@g****m | 15 |
| Rafael Mendonça França | r****a@g****m | 8 |
| stereobooster | s****r@g****m | 7 |
| Ryunosuke SATO | t****s@g****m | 5 |
| Magnus Holm | j****r@g****m | 5 |
| Akira Matsuda | r****e@d****p | 5 |
| Erik Michaels-Ober | s****k@g****m | 4 |
| Sam | s****n@g****m | 3 |
| Aaron Patterson | a****n@g****m | 3 |
| Peter Wagenet | p****t@g****m | 2 |
| Nicholas D. Wolfwood | b****e@g****g | 2 |
| Matt Burke | s****s@g****m | 2 |
| Luis Lavena | l****a@g****m | 2 |
| Jun Aruga | j****a@r****m | 2 |
| Stephen Waits | s****e@w****t | 2 |
| Sébastien Gaya | s****a@g****m | 2 |
| m-nakamura145 | m****5@g****m | 2 |
| Ville Lautanala | l****s@g****m | 2 |
| Jason Meller | j****n@k****o | 2 |
| Guillermo Iguaran | g****n@g****m | 2 |
| Darío Hereñú | m****a@g****m | 2 |
| Bruno Aguirre | yo@b****m | 2 |
| Benjamin | p****n | 2 |
| Andrew White | a****e@u****o | 2 |
| Todd Fisher | t****r@l****m | 1 |
| Reese Armstrong | r****e@o****g | 1 |
| Marcus Brito | m****o@e****r | 1 |
| and 28 more... | ||
Committer domains:
- member.fsf.org: 1
- sitnik.ru: 1
- buiko.com: 1
- janlelis.de: 1
- joelsplace.sg: 1
- emptyflask.net: 1
- lucasimone.info: 1
- reeseric.ci: 1
- intertwingly.net: 1
- weppos.net: 1
- keil.or.at: 1
- pepabo.com: 1
- jonathanmoss.me: 1
- ojab.ru: 1
- easy.cz: 1
- ecore.com.br: 1
- obl.ong: 1
- livingsocial.com: 1
- unboxed.co: 1
- brunoaguirre.com: 1
- kolide.co: 1
- waits.net: 1
- redhat.com: 1
- gentoo.org: 1
- dio.jp: 1
- 37signals.com: 1
- joshpeek.com: 1
Issue and Pull Request metadata
Last synced: 25 days ago
Total issues: 68
Total pull requests: 60
Average time to close issues: 5 months
Average time to close pull requests: 5 months
Total issue authors: 67
Total pull request authors: 36
Average comments per issue: 3.15
Average comments per pull request: 2.18
Merged pull request: 42
Bot issues: 0
Bot pull requests: 0
Past year issues: 0
Past year pull requests: 3
Past year average time to close issues: N/A
Past year average time to close pull requests: about 11 hours
Past year issue authors: 0
Past year pull request authors: 2
Past year average comments per issue: 0
Past year average comments per pull request: 0.67
Past year merged pull request: 2
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- Schwad (2)
- SamSaffron (1)
- theo-bittencourt (1)
- connorshea (1)
- SuwakoMmh (1)
- saghoshprogress (1)
- rafalpetryka (1)
- jrafanie (1)
- maisumakun (1)
- yagarea (1)
- blaccout47 (1)
- mpz (1)
- Nerian (1)
- AlZero-t (1)
- 1026cy (1)
Top Pull Request Authors
- eregon (7)
- tricknotes (3)
- junaruga (3)
- m-nakamura145 (3)
- amatsuda (3)
- casperisfine (3)
- byroot (2)
- tomocrafter (2)
- SebouChu (2)
- SamSaffron (2)
- viralpraxis (2)
- kuyseng (2)
- mattmenefee (2)
- josh (2)
- paulmakepeace (1)
Top Issue Labels
Top Pull Request Labels
Package metadata
- Total packages: 14
-
Total downloads:
- rubygems: 778,876,075 total
- Total docker downloads: 1,520,116,534
- Total dependent packages: 325 (may contain duplicates)
- Total dependent repositories: 1,039,082 (may contain duplicates)
- Total versions: 170
- Total maintainers: 13
gem.coop: execjs
ExecJS lets you run JavaScript code from Ruby.
- Homepage: https://github.com/rails/execjs
- Documentation: http://www.rubydoc.info/gems/execjs/
- Licenses: MIT
- Latest release: 2.10.0 (published over 1 year ago)
- Last Synced: 2026-02-28T12:03:19.379Z (3 days ago)
- Versions: 53
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 389,413,787 Total
- Docker Downloads: 760,058,267
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 0.045%
- Downloads: 0.059%
- Docker downloads count: 0.122%
- Maintainers (13)
rubygems.org: execjs
ExecJS lets you run JavaScript code from Ruby.
- Homepage: https://github.com/rails/execjs
- Documentation: http://www.rubydoc.info/gems/execjs/
- Licenses: MIT
- Latest release: 2.10.0 (published over 1 year ago)
- Last Synced: 2026-03-01T15:03:53.157Z (2 days ago)
- Versions: 53
- Dependent Packages: 324
- Dependent Repositories: 1,039,081
- Downloads: 389,462,288 Total
- Docker Downloads: 760,058,267
-
Rankings:
- Dependent repos count: 0.005%
- Downloads: 0.053%
- Dependent packages count: 0.134%
- Docker downloads count: 0.171%
- Average: 0.735%
- Forks count: 1.505%
- Stargazers count: 2.543%
- Maintainers (13)
proxy.golang.org: github.com/rails/execjs
- Homepage:
- Documentation: https://pkg.go.dev/github.com/rails/execjs#section-documentation
- Licenses: mit
- Latest release: v2.10.0+incompatible (published over 1 year ago)
- Last Synced: 2026-03-02T02:27:22.624Z (1 day ago)
- Versions: 53
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Forks count: 1.61%
- Stargazers count: 2.674%
- Average: 6.165%
- Dependent packages count: 9.576%
- Dependent repos count: 10.802%
conda-forge.org: rb-execjs
- Homepage: https://rubygems.org/gems/execjs
- Licenses: MIT
- Latest release: 2.7.0 (published over 6 years ago)
- Last Synced: 2026-02-03T04:50:32.953Z (28 days ago)
- Versions: 1
- Dependent Packages: 1
- Dependent Repositories: 1
-
Rankings:
- Forks count: 10.305%
- Stargazers count: 18.115%
- Average: 20.434%
- Dependent repos count: 24.343%
- Dependent packages count: 28.974%
debian-10: ruby-execjs
- Homepage: https://github.com/rails/execjs
- Documentation: https://packages.debian.org/buster/ruby-execjs
- Licenses:
- Latest release: 2.6.0-1 (published 20 days ago)
- Last Synced: 2026-02-13T04:21:07.223Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-11: ruby-execjs
- Homepage: https://github.com/rails/execjs
- Documentation: https://packages.debian.org/bullseye/ruby-execjs
- Licenses:
- Latest release: 2.7.0-1 (published 20 days ago)
- Last Synced: 2026-02-13T08:20:03.033Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-12: ruby-execjs
- Homepage: https://github.com/rails/execjs
- Documentation: https://packages.debian.org/bookworm/ruby-execjs
- Licenses:
- Latest release: 2.8.1-1 (published 18 days ago)
- Last Synced: 2026-02-12T23:28:52.106Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
debian-13: ruby-execjs
- Homepage: https://github.com/rails/execjs
- Documentation: https://packages.debian.org/trixie/ruby-execjs
- Licenses:
- Latest release: 2.8.1-2 (published 19 days ago)
- Last Synced: 2026-02-13T13:15:08.664Z (18 days ago)
- Versions: 1
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 0.0%
- Dependent packages count: 0.0%
- Average: 100%
Dependencies
- actions/checkout v2 composite
- ruby/setup-ruby v1 composite
- duktape >= 0 development
- mini_racer >= 0 development
- minitest >= 0 development
- therubyrhino >= 1.73.3 development
- rake >= 0 development
Score: 31.984820654484423