This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-08
Channels
- # beginners (76)
- # boot (13)
- # cider (3)
- # clara (7)
- # cljs-dev (254)
- # cljsrn (5)
- # clojure (20)
- # clojure-austin (2)
- # clojure-chicago (4)
- # clojure-dev (7)
- # clojure-russia (5)
- # clojure-spec (18)
- # clojurescript (68)
- # cursive (8)
- # datascript (3)
- # datomic (8)
- # garden (1)
- # hoplon (3)
- # lambdaisland (4)
- # luminus (20)
- # mount (19)
- # off-topic (30)
- # om (10)
- # onyx (8)
- # parinfer (14)
- # precept (7)
- # reagent (9)
- # unrepl (3)
- # untangled (72)
- # vim (4)
- # yada (1)
I'm trying to start a boot-nodejs project. I follow this guide: https://specious.github.io/blog/2016/12/07/Starting-a-NodeJS-app-with-ClojureScript-and-Boot/ For some reason, I get this error:
$ node main.js
<PROJECT_HOME>/target/main.js:16
var k="undefined"!==typeof Math.imul&&0!==Math.imul(4294967295,5)?function(a,d){return Math.imul(a,d)}:function(a,d){var e=a&65535,f=d&65535;return e*f+((a>>>16&65535)*f+e*(d>>>16&65535)<<16>>>0)|0};function l(a){a=k(a|0,-862048943);a=0^(
k(a<<15|a>>>-15,461845907)|0);a=(k(a<<13|a>>>-13,5)+-430675100|0)^0;a=k(a^a>>>16,-2048144789);k(a^a>>>13,-1028477387)}l(1);l(0);throw Error("cljs.core/*main-cli-fn* not set");
^
Error: cljs.core/*main-cli-fn* not set
at Error (native)
at Object.<anonymous> (<PROJECT_HOME>/server/target/main.js:16:373)
at Module._compile (module.js:570:32)
There's only 1 ns so far:
(ns server.core
(:require [cljs.nodejs :as nodejs]))
(nodejs/enable-util-print!)
(defn main [& args]
(println "Abracadabra!"))
(set! *main-cli-fn* main)
build.boot
:
(def project 'server)
(def version "0.1.0-SNAPSHOT")
(set-env!
:source-paths #{"src"}
:dependencies '[[adzerk/boot-cljs "RELEASE" :scope "test"]])
(require
'[adzerk.boot-cljs :refer [cljs]])
(deftask dev
"Watch/compile files in development"
[]
(comp
(watch)
(cljs :source-map true
:optimizations :none
:compiler-options {:target :nodejs})
(target)))
(deftask prod
"Compile for production"
[]
(comp
(cljs :optimizations :advanced
:compiler-options {:target :nodejs})
(target)))
@kurt-o-sys try setting a :main
namespace in the compiler options
e.g. :main 'server.core
oh... right.
... problem was wrong file extension (`.clj` -> .cljs
)
i was googling around but can't find how to pretty print the return values in boot repl
i even see there is boot.from.io.aviso.repl/pretty-print
but it's not used...
(okay, maybe i should grep the boot source for this function to get a clue...)
looks like puget uses this package to provide a middleware, but it also seems very leiningen specific:
https://github.com/greglook/whidbey
(im not using cider, btw. i was just talking about using boot repl
from the terminal)
i have this cider
boot task in my ~/.boot/profile.boot
but this doesn't seem to help with pretty printing:
(deftask cider "CIDER profile"
[]
(require 'boot.repl)
(swap! @(resolve 'boot.repl/*default-dependencies*)
concat '[#_[org.clojure/tools.nrepl "0.2.12"]
[cider/cider-nrepl "0.14.0"]
[refactor-nrepl "2.3.0-SNAPSHOT"]])
(swap! @(resolve 'boot.repl/*default-middleware*)
concat '[cider.nrepl/cider-middleware
refactor-nrepl.middleware/wrap-refactor])
identity)
i see the last commit in https://github.com/clojure-emacs/cider-nrepl is yours 🙂 im reading the via Boot section now...