Compile and Run a ClojureScript Command-line App on Node.js with Lumo

Alan Shaw
InstructorAlan Shaw
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 5 years ago

We'll use Lumo, a cross-platform standalone ClojureScript compiler and Node.js environment, to create Hello as a command-line application.

In this lesson, I’ll show you how to install Lumo through NPM, invoke a function in ClojureScript, and use the println function from the core library.

Instructor: [00:00] We're going to create a ClojureScript command line app on Node the easy way with Lumo. The first thing we need to do is make sure we have Lumo installed. I'm using NPM to install it.

[00:17] You can see that the NPM package is Lumo-cljs, but the executable that we get is just called Lumo. If you're interested in installing it in a different way, such as Homebrew or Docker, have a look at this web page. Now we're going to go to the program itself.

[00:38] We're going to call our program Hello.cljs. The first thing we want to do in our script is use the environment to set Lumo as the interpreter for our script. Now comes the script itself. The program consists of this one line.

[01:00] In ClojureScript, we invoke a function, in this case, print line, by setting it as the first item in a parenthesized list. The remaining items in the list, in this case, the single string Hello Node, are the arguments to the function.

[01:16] Having written our program, we will save it. We want to make it executable, so we will use the well-known chmod command to do so. Now we can run it. Lumo has compiled it to JavaScript and executed it in the Node environment.

Stephen Matthew Davies
Stephen Matthew Davies
~ 3 years ago

Doesn't work, unfortunately. Installing lumo via npm does not add it to an env,

Stephen Matthew Davies
Stephen Matthew Davies
~ 3 years ago

env: lumo: No such file or directory

Stephen Matthew Davies
Stephen Matthew Davies
~ 3 years ago

Also, no brew formula found for lumo, I think this course is massively outdated

Alan Shaw
Alan Shawinstructor
~ 3 years ago

Yes, it appears that lumo is no longer available via brew, but installing it with npm still works. Npm installs lumo in /usr/local/bin. Env will find lumo if that directory is in your PATH.

Markdown supported.
Become a member to join the discussionEnroll Today