Configure your system to evaluate external JavaScript code.

For Mac...

Install NodeJS

NodeJS can be installed for Mac through package repositories such as Homebrew or MacPorts, or by using the installer downloaded from http://nodejs.org.

To install using Homebrew:

$ brew install nodejs

To install using MacPorts:

$ port install nodejs

To install using the installer from nodejs.org, download the installer, double-click the resulting .pkg file, and follow the instructions.

Install the ZeroMQ package for NodeJS

Install the ZeroMQ package for NodeJS using the node package manager, npm. By default, npm will install the package to a folder named node_modules, but for ExternalEvaluate to find the installation, it needs to be placed in a directory called .node_modules in the home directory:

$ cd ~
$ npm install zeromq
$ mv node_modules .node_modules

Verify the installation

If the installation was successful, FindExternalEvaluators will find it automatically:

In[1]:=
Click for copyable input
Out[1]=

Evaluate JavaScript using NodeJS

Use the NodeJS installation to evaluate JavaScript code:

Out[2]=

For Windows...

Install NodeJS

Download the NodeJS installer at http://nodejs.org and run the resulting executable file.

Install the ZeroMQ package for NodeJS

Install the ZeroMQ package for NodeJS using the node package manager, npm. By default, npm will install the package to a folder named node_modules, but for ExternalEvaluate to find the installation, it needs to be placed in a directory called .node_modules in the home directory:

> cd %HOME%
> npm.exe install zeromq
> ren node_modules .node_modules

Verify the installation

If the installation was successful, FindExternalEvaluators will find it automatically:

In[3]:=
Click for copyable input
Out[3]=

Evaluate JavaScript using NodeJS

Use the NodeJS installation to evaluate JavaScript code:

Out[4]=

For Linux...

Install NodeJS

NodeJS is available from most Linux package repositories such as APT or yum, or you can download an installer at http://nodejs.org.

On Ubuntu-based systems with the APT package repository, NodeJS can be installed with:

$ sudo apt-get update && sudo apt-get install -y nodejs npm

On Fedora or Red Hat systems with the yum package repository, NodeJS can be installed with:

$ sudo yum install -y nodejs

Install the ZeroMQ package for NodeJS

Install the ZeroMQ package for NodeJS using the node package manager, npm. By default, npm will install the package to a folder named node_modules, but for ExternalEvaluate to find the installation, it needs to be placed in a directory called .node_modules in the home directory:

$ cd ~
$ npm install zeromq
$ mv node_modules .node_modules

Verify the installation

If the installation was successful, FindExternalEvaluators will find it automatically:

In[5]:=
Click for copyable input
Out[5]=

Evaluate JavaScript using NodeJS

Use the NodeJS installation to evaluate JavaScript code:

Out[6]=
Notes
If you have installed NodeJS according to the preceding steps, but it is not discovered by FindExternalEvaluators, you can register it manually with RegisterExternalEvaluator; for example:
In[7]:=
Click for copyable input
Out[7]=