Skip to content
dielc edited this page Sep 25, 2014 · 7 revisions

The easiest way to develop in Opa on most platforms is to use a vagrant box. Install vagrant (and VirtualBox on some platforms).

Setup

Install vagrant and run

vagrant init mlstate/opa

The box is a linux system running in a VM that contains a pre-built Opa system with all dependencies. Once the box is created, run:

vagrant up
vagrant ssh

to start the VM and log into it.

Test your setup

Opa is installed and in user path, so you can just run

opa file.opa
./file.js

to compile and run an Opa program. Note that tutorials are preinstalled in your home directory.

Note: to see the actual output in your host browser, you need to do some port forwarding in Virtual-box. Click on your machine > settings > network > port forwarding. Then add a new rule with the following information: Name: Opa, Protocol: tcp, Host port: 8080, Guest port: 8080. Leave the other fields blank. You can now see your application in your host browser on http://localhost:8080/

Host-VM interaction

If you're new to vagrant, note that the host directory is mounted under /vagrant in the VM, so you can leave Opa programs in your host and just keep a console in the VM to compile and run your apps.

Problems

If you run your application and get the following message. 1 Module missing. Please run: sudo npm install -g ursa. You might need to first need to perform these commands: sudo apt-get install nodejs and sudo apt-get install npm before you can run sudo npm install -g ursa