Skip to content

Instantly share code, notes, and snippets.

@jafingerhut
Created October 2, 2019 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jafingerhut/0914366de07ea067254e5ed3ecd5a452 to your computer and use it in GitHub Desktop.
Save jafingerhut/0914366de07ea067254e5ed3ecd5a452 to your computer and use it in GitHub Desktop.
Creating a cljs REPL from terminal using deps.edn and clj command
;; Save this file as deps.edn in some directory that doesn't already
;; have such a file.
;; You must have the following installed for the command below to have
;; a chance of working:
;; + A JDK, e.g. from AdoptOpenJDK web site: https://adoptopenjdk.net
;; + Clojure CLI tools. Install instructions here:
;; https://clojure.org/guides/getting_started
;; + Node.js JavaScript runtime environment. Some prepackaged ways to
;; install:
;; + Ubuntu 18.04 Linux: `sudo apt-get install nodejs`
;; + macOS
;; + plus Homebrew: `brew install node`
;; + plus MacPorts: `sudo port install nodejs10`. You can see
;; other versions available via the command `port list | grep
;; nodejs`.
;; clj -m cljs.main --repl-env node
;; If that is successful, you should eventually see output like this:
;; $ clj -m cljs.main --repl-env node
;; ClojureScript 1.10.520
;; cljs.user=>
;; At the REPL, I could evaluate these forms without errors:
;; (require '[clojure.core.matrix :as m])
;; (require '[clojure.core.matrix.dataset :as d])
;; I have not tried using the core.matrix library any more extensively
;; than that, yet.
;; In the directory where you run this, a .cpcache directory will be
;; created by clj to cache information about dependencies.
{:deps {org.clojure/clojurescript {:mvn/version "1.10.520"}
net.mikera/core.matrix {:mvn/version "0.62.0"}}
:aliases
{:socket {:jvm-opts ["-XX:-OmitStackTraceInFastThrow"
"-Dclojure.server.repl={:port,50505,:accept,cljs.server.node/repl}"]}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment