shadow-cljs fails with [org.clojure/clojurescript "1.10.891" - works with 1.10.879

102 views
Skip to first unread message

Benno Löffler

unread,
Nov 9, 2021, 6:45:05 AM11/9/21
to Luminus
Hi,
i've created a project:
lein new luminus n02-cream-s +cljs +shadow-cljs +reagent

there are two things, I don't understand:
  1. running  > shadow-cljs app watch gives me a:
    > java.lang.ClassNotFoundException: com.google.javascript.jscomp.JSModule
    The template uses [org.clojure/clojurescript "1.10.891" :scope "provided"]
    But the shadow-cljs needs: "1.10.879"
    At least the error message said so.
    Changing that in project.clj seems to work.
    But shows a second problem...
  2. running > shadow-cljs app watch 
    > The required namespace "react" is not available, it was required by "reagent/core.cljs".
  3. This may be solved by
    > npm install
    because there is a package.json:
    {
      "devDependencies": {
        "shadow-cljs": "^2.14.3"
      },
      "dependencies":{
        "react": "^17.0.2",
        "react-dom": "^17.0.2"
      }
    }


SELF-MANAGED PACKAGE.JSON

By default, luminus configures lein-shadow to store npm dependencies in a :npm-deps key in the project.clj file. Sometimes, you may wish to self-manage these, in order to expand on the package.json config. To do this, you have to remove the :npm-deps key from your project.clj file, and create a package.json file instead. Now lein-shadow will skip checking for npm dependencies on execution, and you will have to manually run npm install and update your package.json accordingly.


Hmmmm... There is no :npm-deps in my project.clj,
which seems to be the reason for the need of  npm install

(defproject n02-cream-s "0.1.0-SNAPSHOT"
  :description "FIXME: write description"

  :dependencies [[ch.qos.logback/logback-classic "1.2.6"]
                 [cljs-ajax "0.8.4"]
                 [clojure.java-time "0.3.3"]
                 [com.cognitect/transit-clj "1.0.324"]
                 [com.cognitect/transit-cljs "0.8.269"]
                 [cprop "0.1.19"]
                 [expound "0.8.10"]
                 [funcool/struct "1.4.0"]
                 [json-html "0.4.7"]
                 [luminus-transit "0.1.2"]
                 [luminus-undertow "0.1.12"]
                 [luminus/ring-ttl-session "0.3.3"]
                 [markdown-clj "1.10.6"]
                 [metosin/muuntaja "0.6.8"]
                 [metosin/reitit "0.5.15"]
                 [metosin/ring-http-response "0.9.3"]
                 [mount "0.1.16"]
                 [nrepl "0.8.3"]
                 [org.clojure/clojure "1.10.3"]

;; CHANGED THAT TO 879
                 [org.clojure/clojurescript "1.10.879" :scope "provided"]

                 [org.clojure/core.async "1.3.622"]
                 [org.clojure/tools.cli "1.0.206"]
                 [org.clojure/tools.logging "1.1.0"]
                 [org.webjars.npm/bulma "0.9.3"]
                 [org.webjars.npm/material-icons "1.0.0"]
                 [org.webjars/webjars-locator "0.42"]
                 [org.webjars/webjars-locator-jboss-vfs "0.1.0"]
                 [reagent "1.1.0"]
                 [ring-webjars "0.2.0"]
                 [ring/ring-core "1.9.4"]
                 [ring/ring-defaults "0.3.3"]
                 [selmer "1.12.44"]
                 [thheller/shadow-cljs "2.15.12" :scope "provided"]]

  :min-lein-version "2.0.0"
 
  :source-paths ["src/clj" "src/cljs" "src/cljc"]
  :test-paths ["test/clj"]
  :resource-paths ["resources" "target/cljsbuild"]
  :target-path "target/%s/"
  :main ^:skip-aot n02-cream-s.core

  :plugins []
  :clean-targets ^{:protect false}
  [:target-path "target/cljsbuild"]
 

  :profiles
  {:uberjar {:omit-source true
             
             :prep-tasks ["compile" ["run" "-m" "shadow.cljs.devtools.cli" "release" "app"]]
             :aot :all
             :uberjar-name "n02-cream-s.jar"
             :source-paths ["env/prod/clj"  "env/prod/cljs" ]
             :resource-paths ["env/prod/resources"]}

   :dev           [:project/dev :profiles/dev]
   :test          [:project/dev :project/test :profiles/test]

   :project/dev  {:jvm-opts ["-Dconf=dev-config.edn" ]
                  :dependencies [[binaryage/devtools "1.0.4"]
                                 [cider/piggieback "0.5.2"]
                                 [org.clojure/tools.namespace "1.1.0"]
                                 [pjstadig/humane-test-output "0.11.0"]
                                 [prone "2021-04-23"]
                                 [ring/ring-devel "1.9.4"]
                                 [ring/ring-mock "0.4.0"]]
                  :plugins      [[com.jakemccrary/lein-test-refresh "0.24.1"]
                                 [jonase/eastwood "0.3.5"]
                                 [cider/cider-nrepl "0.26.0"]]
                 
                 
                  :source-paths ["env/dev/clj"  "env/dev/cljs" "test/cljs" ]
                  :resource-paths ["env/dev/resources"]
                  :repl-options {:init-ns user
                                 :timeout 120000}
                  :injections [(require 'pjstadig.humane-test-output)
                               (pjstadig.humane-test-output/activate!)]}
   :project/test {:jvm-opts ["-Dconf=test-config.edn" ]
                  :resource-paths ["env/test/resources"]
                 
                 
                  }
   :profiles/dev {}
   :profiles/test {}})


shadow-cljs --cli-info shows:
shadow-cljs - config: /home/benno/projects/n02-cream-s/shadow-cljs.edn
=== Version
jar:            2.16.0
cli:            2.16.0
deps:           1.3.2
config-version: 2.16.0

=== Paths
cli:     /usr/lib/node_modules/shadow-cljs/cli/dist.js
config:  /home/benno/projects/n02-cream-s/shadow-cljs.edn
project: /home/benno/projects/n02-cream-s
cache:   .shadow-cljs

=== Java
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)


What do I do wrong? Or is it two bugs?

Thanks
Benno
Reply all
Reply to author
Forward
0 new messages