Skip to content
A linked-in driver for Erlang to Mozilla's Spidermonkey Javascript runtime.
Erlang Makefile C JavaScript Diff Shell
Latest commit f77c90a Mar 20, 2015 @borshop borshop Merge pull request #48 from basho/bugfix/toolsmk
Update erlang_js to use

Reviewed-by: cmeiklejohn
Failed to load latest commit information.
c_src Replace deprecated driver_output_term with erl_drv_output_term Nov 17, 2014
priv Update to the latest version of Douglas Rockford's json2.js that fixes Feb 16, 2011
src Update erlang_js to use Mar 20, 2015
test Permit quotes in anonymous functions Nov 12, 2013
.gitignore Ignore tags. Aug 21, 2013
.hgignore .hgignore: Feb 12, 2010
.hgtags Added tag erlang_js-0.4 for changeset 4d97f731ecdc Jul 13, 2010
.travis.yml Add bot webhook. Jul 2, 2012
GNUmakefile Update erlang_js to use Mar 20, 2015
LICENSE Adding license headers to C source Jan 14, 2010
Makefile Clear out MAKEFLAGS variable on FreeBSD that casued build errors Jun 13, 2012 Tweaks to get docs building reliably Jan 18, 2010
rebar.config Update erlang_js to use Mar 20, 2015 Update erlang_js to use Mar 20, 2015



Travis-CI ::

erlang_js is a linked-in driver, API, and OTP application that embeds Mozilla’s Spidermonkey Javascript Virtual Machine in Erlang. Originally created to facilitate usage of Riak’s MapReduce by non-Erlang programmers, it supports multiple concurrent Javascript VMs, runtime evaluation of Javascript code, and invocation of Javascript functions.

erlang_js builds and executes only on Unix-based platforms, including Linux, Mac OS/X, and Solaris. It includes version 1.8.0 of Spidermonkey and Douglas Crockford’s json2.js JSON parser. More information about the features available to Javascript inside erlang_js are detailed on the Mozilla Developer Center.

Quick Start

You must have Erlang/OTP R13B04 or later and a GNU-style build system to compile and run erlang_js.

git clone git://
make all test

Start up an Erlang shell with the path to erlang_js included.

erl -pa path/to/erlang_js/ebin -boot start_sasl

Start the erlang_js application and create a Javascript VM.

1> application:start(erlang_js).

=PROGRESS REPORT==== 17-Feb-2011::11:31:51 ===
          supervisor: {local,erlang_js_sup}
             started: [{pid,<0.46.0>},

=PROGRESS REPORT==== 17-Feb-2011::11:31:51 ===
         application: erlang_js
          started_at: nonode@nohost
2> {ok, JS} = js_driver:new().

Now you can evaluate Javascript expressions and call Javascript functions.

3> js:define(JS, <<"var addOne = function(a){ return a + 1; }">>).
4> js:call(JS, <<"addOne">>, [3]).


Documentation about the API is extensive and can be generated by edoc.

$ make docs
$ open docs/index.html


We encourage contributions to erlang_js from the community.

  1. Fork the erlang_js repository on Github.
  2. Clone your fork or add the remote if you already have a clone of the repository.
git clone
# or
git remote add mine
  1. Create a topic branch for your change.
git checkout -b some-topic-branch
  1. Make your change and commit. Use a clear and descriptive commit message, spanning multiple lines if detailed explanation is needed.
  2. Push to your fork of the repository and then send a pull-request through Github.
git push mine some-topic-branch
  1. A Basho engineer or community maintainer will review your patch and merge it into the main repository or send you feedback.
Something went wrong with that request. Please try again.