lumo

:lumo: Standalone ClojureScript environment. Currently at version 1.9.0
anmonteiro 2017-08-03T00:44:37.418196Z

@souenzzo don’t use sudo

anmonteiro 2017-08-03T00:44:41.419067Z

that’s fixed in master

souenzzo 2017-08-03T00:48:01.463641Z

I know and I want to install on /usr/lib/node_modules ... In older versions, I was sucessfull.

souenzzo 2017-08-03T00:52:33.523635Z

https://github.com/anmonteiro/lumo/blob/master/packages/lumo/package.json#L20 if which nodejs; then nodejs scripts/npm_install.js; else node scripts/npm_install.js; fi (if there is some command called nodejs, use nodejs, else use node). Should work.

anmonteiro 2017-08-03T00:53:02.529774Z

but that’s not the problem you’re having

anmonteiro 2017-08-03T00:53:29.535713Z

@souenzzo this is your issue https://github.com/anmonteiro/lumo/pull/207

souenzzo 2017-08-03T00:55:10.557434Z

Ok. I will install locally for now.

souenzzo 2017-08-03T00:55:20.559700Z

sorry 😅

anmonteiro 2017-08-03T00:57:23.587074Z

np

rberger 2017-08-03T08:25:15.505762Z

So just for anyone else who follows up on the earlier thread on using some npm git libraries: Turns out the trick for making the

(def git ((js/require "simple-git") "./"))
Work wasn’t the addition of the "./" but the fact that the result of (js/require "simple-git") needed to be executed as a function call. (This might be obvious to others but it wasn’t to me.) I put together what I learnt into an example git repo https://github.com/rberger/lumo-npm-example to help anyone else who comes along before there is more documentation. Would appreciate any feedback on what I might got wrong or could have done better! Thanks again for the help, I’m sure I’ll be back with more questions! 🙂

richiardiandrea 2017-08-03T08:28:57.591051Z

@rberger that depends on the module, unfortunately the js world is not that straightforward regarding module require. So you required a module that exports a function (constructor) that when called returns the object.

richiardiandrea 2017-08-03T08:29:23.600993Z

This is were cljs shines with its namespaces

pesterhazy 2017-08-03T08:52:19.137186Z

yeah npm modules often expose a "constructor function"

rb1719 2017-08-03T10:45:32.682180Z

Hi all. How do you turn off the new rewriting feature as it breaks core.matrix?

dominicm 2017-08-03T10:49:10.750954Z

referring to the clojure.core.X becoming cljs.core.X ^^

anmonteiro 2017-08-03T16:15:55.059124Z

need more information here

anmonteiro 2017-08-03T16:15:59.061740Z

breaks how?

anmonteiro 2017-08-03T16:16:10.068344Z

there’s no really turning it off

anmonteiro 2017-08-03T16:16:19.073876Z

it might be an upstream bug that needs to be fixed in the compiler

dominicm 2017-08-03T16:20:57.246953Z

@anmonteiro it tried to require cljs.core.matrix which doesn't exist

dominicm 2017-08-03T16:39:10.917334Z

Core matrix perhaps shouldn't use the clojure prefix.

anmonteiro 2017-08-03T16:48:54.265555Z

@dominicm perhaps it’s a classpath problem?

anmonteiro 2017-08-03T16:49:33.289258Z

or core matrix is just not self-hosted compat?

anmonteiro 2017-08-03T16:51:52.373274Z

CLJS is never going to see that

anmonteiro 2017-08-03T16:51:58.377297Z

because it’s defined under a :clj reader conditional

anmonteiro 2017-08-03T16:52:09.383647Z

doesn’t seem related to clojure -> clj aliasing at all

dominicm 2017-08-03T16:52:34.398782Z

@anmonteiro I think this is related to the change which requires clojure. to cljs.? There is no cljs.core.matrix, clojure.core.matrix is the entry point.

anmonteiro 2017-08-03T16:52:53.410255Z

and I just did (require 'clojure.core.matrix)

anmonteiro 2017-08-03T16:53:02.415343Z

and it started loading clojure.core.matrix

anmonteiro 2017-08-03T16:53:15.423163Z

by that logic we would never be able to require clojure.string or clojure.set

anmonteiro 2017-08-03T16:53:20.425946Z

which we can

anmonteiro 2017-08-03T16:53:52.445665Z

what may be confusing for you is the error, which says it can’t cljs.core.matrix, could not locate cljs/core/matrix.cljs

anmonteiro 2017-08-03T16:54:19.461611Z

but here’s the reason for that to happen: we tried loading clojure/core/matrix.clj* and it failed

anmonteiro 2017-08-03T16:54:25.465389Z

so we’ll try the cljs version

dominicm 2017-08-03T16:54:52.482027Z

Yeah, that's why I figured it was related to. I also assumed clojurescript had either a whitelist or I should have been using cljs.string the whole time ;)

anmonteiro 2017-08-03T16:55:28.504703Z

core.matrix is just not self-host compatible

dominicm 2017-08-03T16:56:26.540787Z

Makes sense. A shame it doesn't print everything it tried. I'm also surprised an error loading would cause it to error on found.

dominicm 2017-08-03T16:56:40.549658Z

What is the restriction on self host here? What is preventing it from working I mean.

anmonteiro 2017-08-03T16:57:35.584350Z

it probably does if you start lumo with -v / --verbose

anmonteiro 2017-08-03T16:58:13.608246Z

see the 2 links I pasted above. there’s a macro vector-1d? that’s only defined in :clj

anmonteiro 2017-08-03T16:58:16.610533Z

self-host can’t expand it

dominicm 2017-08-03T16:58:26.616946Z

(Just comparing to clojure's message there which is could not find x.clj, x.cljc or x.class)

anmonteiro 2017-08-03T16:58:47.629090Z

the error message doesn’t really tell you the problem, I’ll give you that

anmonteiro 2017-08-03T16:58:53.633048Z

I’ll open an issue

anmonteiro 2017-08-03T16:59:48.667114Z

this is perhaps an upstream issue though

anmonteiro 2017-08-03T16:59:51.669035Z

cc @mfikes

anmonteiro 2017-08-03T17:00:31.696281Z

TLDR is https://github.com/anmonteiro/lumo/issues/226

dominicm 2017-08-03T17:02:22.765270Z

Oh, I see. It's trying to do the self-require thing to get the clojure macros. That's always made my head spin a little. I misread, I thought it was including a cljs compatible version in cljs. And then defining it for clojure.

mfikes 2017-08-03T17:02:22.765424Z

Yeah, it falls back from clojure.* to cljs.* but perhaps it should distinguish between absolutely not being able to find the namespace, vs. finding it but having an error loading it.

👍 1
dominicm 2017-08-03T17:02:26.768001Z

Thanks for taking the time to explain it to me. It really helped.

anmonteiro 2017-08-03T17:14:14.188586Z

np