@souenzzo don’t use sudo
that’s fixed in master
I know and I want to install on /usr/lib/node_modules
... In older versions, I was sucessfull.
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.
but that’s not the problem you’re having
@souenzzo this is your issue https://github.com/anmonteiro/lumo/pull/207
Ok. I will install locally for now.
sorry 😅
np
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! 🙂@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.
This is were cljs shines with its namespaces
yeah npm modules often expose a "constructor function"
Hi all. How do you turn off the new rewriting feature as it breaks core.matrix?
referring to the clojure.core.X becoming cljs.core.X ^^
need more information here
breaks how?
there’s no really turning it off
it might be an upstream bug that needs to be fixed in the compiler
@anmonteiro it tried to require cljs.core.matrix which doesn't exist
Core matrix perhaps shouldn't use the clojure prefix.
@dominicm perhaps it’s a classpath problem?
or core matrix is just not self-hosted compat?
case in point: https://github.com/mikera/core.matrix/blob/develop/src/main/clojure/clojure/core/matrix/impl/persistent_vector.cljc#L21
CLJS is never going to see that
because it’s defined under a :clj
reader conditional
doesn’t seem related to clojure -> clj aliasing at all
@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.
and I just did (require 'clojure.core.matrix)
and it started loading clojure.core.matrix
by that logic we would never be able to require clojure.string
or clojure.set
which we can
what may be confusing for you is the error, which says it can’t cljs.core.matrix, could not locate cljs/core/matrix.cljs
but here’s the reason for that to happen: we tried loading clojure/core/matrix.clj*
and it failed
so we’ll try the cljs
version
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 ;)
core.matrix
is just not self-host compatible
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.
What is the restriction on self host here? What is preventing it from working I mean.
it probably does if you start lumo with -v / --verbose
see the 2 links I pasted above. there’s a macro vector-1d?
that’s only defined in :clj
self-host can’t expand it
(Just comparing to clojure's message there which is could not find x.clj, x.cljc or x.class)
the error message doesn’t really tell you the problem, I’ll give you that
I’ll open an issue
this is perhaps an upstream issue though
cc @mfikes
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.
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.
Thanks for taking the time to explain it to me. It really helped.
np