Failed to compile in a 'lein new figwheel foo -- --reagent'

284 views Asked by At

I want to start a project with reagent and figwheel and I have done it before with that command and it has worked, in fact they still work. But with a new one some of the configurations and versions of dependencies changed and it no longer starts with 'lein fighwheel'. Here is my project.clj

(defproject ajedrez1 "0.1.0-SNAPSHOT"
  :description "FIXME: write this!"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}

  :min-lein-version "2.9.1"

  :dependencies [[org.clojure/clojure "1.10.0"]
                 [org.clojure/clojurescript "1.10.773"]
                 [org.clojure/core.async  "0.4.500"]
                 [reagent "0.10.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server]]]

  :plugins [[lein-figwheel "0.5.20"]
            [lein-cljsbuild "1.1.7" :exclusions [[org.clojure/clojure]]]]

  :source-paths ["src"]

  :cljsbuild {:builds
              [{:id "dev"
                :source-paths ["src"]

                :figwheel {:on-jsload "ajedrez1.core/on-js-reload"
                           :open-urls ["http://localhost:3449/index.html"]}

                :compiler {:main ajedrez1.core
                           :target :bundle
                           :asset-path "js/compiled/out"
                           :output-to "resources/public/js/compiled/out/index.js"
                           :output-dir "resources/public/js/compiled/out"
                           :bundle-cmd {:none ["npx.cmd" "webpack" "--mode=development"]
                                        :default ["npx.cmd" "webpack"]}
                           :source-map-timestamp true
                           
                           :preloads [devtools.preload]}}
              
               {:id "min"
                :source-paths ["src"]
                :compiler {:output-to "resources/public/js/compiled/ajedrez1.js"
                           :main ajedrez1.core
                           :optimizations :advanced
                           :pretty-print false}}]}

  :figwheel {:css-dirs ["resources/public/css"] ;; watch and update CSS}

  :profiles {:dev {:dependencies [[binaryage/devtools "1.0.0"]
                                  [figwheel-sidecar "0.5.20"]]
                   :source-paths ["src" "dev"]
                   :clean-targets ^{:protect false} ["resources/public/js/compiled"
                                                     :target-path]}})

It throws:


Figwheel: Cutting some fruit, just a sec ...
Figwheel: Validating the configuration found in project.clj
Figwheel: Configuration Valid ;)
Figwheel: Starting server at http://0.0.0.0:3449
Figwheel: Watching build - dev
Figwheel: Cleaning build - dev
Compiling build :dev to "resources/public/js/compiled/out/index.js" from ["src"]...
Failed to compile build :dev from ["src"] in 16.531 seconds.
----  Exception    ----

  clojure.lang.ExceptionInfo : :build-cmd :none failed
         java.io.IOException : Cannot run program "npx.cmd": CreateProcess error=2, El sistema no puede encontrar el archivo especificado
         java.io.IOException : CreateProcess error=2, El sistema no puede encontrar el archivo especificado

I tried pulling out:

:exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server]]
:target :bundle
:bundle-cmd {:none ["npx.cmd" "webpack" "--mode=development"]
              :default ["npx.cmd" "webpack"]}

because the previous projects didn't have it and succesfully compiled but the browser only shows "Figwheel template Checkout your developer console." with "Failed to load resource: the server responded with a status of 404 (Not Found)" on the console.

I tried with 'lein clen' after adding:

:clean-targets ^{:protect false} [:target-path
                                    [:cljsbuild :builds :app :compiler
                                     :output-dir]
                                    [:cljsbuild :builds :app :compiler
                                     :output-to]]

but it's the same.

Just in case, I've been experiencing a stack overflow with the repl when I evaluate the same expresion more than one time, the evaluation's time grows with each repetition. I have to restart it periodically.

0

There are 0 answers