I'm trying to use the new feature for using node packages on cljs on Windows 10.
I'm doing a test using the mies template and cljs version 1.9.521 my project.clj file (using cljs source from master): ```clojure (defproject npmtest "0.1.0-SNAPSHOT" :description "FIXME: write this!" :url "http://example.com/FIXME" ;:dependencies [[org.clojure/clojure "1.8.0"] ;[org.clojure/clojurescript "1.9.521"]] :dependencies [[org.clojure/clojure "1.8.0"] [org.clojure/data.json "0.2.6"] [org.clojure/tools.reader "1.0.0-beta3"] [org.clojure/test.check "0.9.0" :scope "test"] [com.cognitect/transit-clj "0.8.285"] [org.clojure/google-closure-library "0.0-20160609-f42b4a24"] [com.google.javascript/closure-compiler-unshaded "v20170409"] [org.mozilla/rhino "1.7R5"]] :jvm-opts ^:replace ["-Xmx1g" "-server"] :plugins [[lein-npm "0.6.1"]] :npm {:dependencies [[source-map-support "0.4.0"] [left-pad "1.1.3"]]} :source-paths ["src" "target/classes" "clojurescript/src/main/cljs" "clojurescript/src/main/clojure" "clojurescript/target/classes"] :clean-targets ["out" "release"] :target-path "target") ``` This is how I modified my build.clj file: ```clojure (require '[cljs.build.api :as b]) (println "Building ...") (let [start (System/nanoTime)] (b/build "src" {:main 'npmtest.core :target :nodejs :npm-deps {:left-pad "1.1.3"} :output-to "out/npmtest.js" :output-dir "out" :verbose true}) (println "... done. Elapsed" (/ (- (System/nanoTime) start) 1e9) "seconds")) ``` This is my core.cljs file: ```clojure (ns npmtest.core (:require [cljs.nodejs :as nodejs] left-pad)) (nodejs/enable-util-print!) (println "Hello world!") ``` This is the error calling scripts\build.bat that I've tried to fix (fix below the error): ``` Building ... Installing Node.js dependencies Exception in thread "main" java.io.IOException: Cannot run program "npm": CreateProcess error=2, Impossibile trovare il file specificato, compiling:(C \DevLab\projects\npmtest\scripts\build.clj:5:1) at clojure.lang.Compiler.load(Compiler.java:7391) at clojure.lang.Compiler.loadFile(Compiler.java:7317) at clojure.main$load_script.invokeStatic(main.clj:275) at clojure.main$script_opt.invokeStatic(main.clj:335) at clojure.main$script_opt.invoke(main.clj:330) at clojure.main$main.invokeStatic(main.clj:421) at clojure.main$main.doInvoke(main.clj:384) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.lang.Var.invoke(Var.java:379) at clojure.lang.AFn.applyToHelper(AFn.java:154) at clojure.lang.Var.applyTo(Var.java:700) at clojure.main.main(main.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93) at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:207) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93) at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:207) at user$eval5.invokeStatic(form-init3240817758129116134.clj:1) at user$eval5.invoke(form-init3240817758129116134.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6927) at clojure.lang.Compiler.eval(Compiler.java:6917) at clojure.lang.Compiler.load(Compiler.java:7379) at clojure.lang.Compiler.loadFile(Compiler.java:7317) at clojure.main$load_script.invokeStatic(main.clj:275) at clojure.main$init_opt.invokeStatic(main.clj:277) at clojure.main$init_opt.invoke(main.clj:277) at clojure.main$initialize.invokeStatic(main.clj:308) at clojure.main$null_opt.invokeStatic(main.clj:342) at clojure.main$null_opt.invoke(main.clj:339) at clojure.main$main.invokeStatic(main.clj:421) at clojure.main$main.doInvoke(main.clj:384) at clojure.lang.RestFn.invoke(RestFn.java:421) at clojure.lang.Var.invoke(Var.java:383) at clojure.lang.AFn.applyToHelper(AFn.java:156) at clojure.lang.Var.applyTo(Var.java:700) at clojure.main.main(main.java:37) Caused by: java.io.IOException: Cannot run program "npm": CreateProcess error=2, Impossibile trovare il file specificato at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at cljs.closure$maybe_install_node_deps_BANG_.invokeStatic(closure.clj:2034) at cljs.closure$maybe_install_node_deps_BANG_.invoke(closure.clj:2027) at cljs.closure$build.invokeStatic(closure.clj:2226) at cljs.closure$build.invoke(closure.clj:2213) at cljs.build.api$build.invokeStatic(api.clj:202) at cljs.build.api$build.invoke(api.clj:189) at cljs.build.api$build.invokeStatic(api.clj:192) at cljs.build.api$build.invoke(api.clj:189) at user$eval6481.invokeStatic(build.clj:6) at user$eval6481.invoke(build.clj:5) at clojure.lang.Compiler.eval(Compiler.java:6927) at clojure.lang.Compiler.load(Compiler.java:7379) ... 42 more Caused by: java.io.IOException: CreateProcess error=2, Impossibile trovare il file specificato at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(ProcessImpl.java:386) at java.lang.ProcessImpl.start(ProcessImpl.java:137) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ... 54 more ``` "Impossibile trovare il file specificato" is italian, means file not found probably because on windows "npm" is "npm.cmd". On cljs.clojure (https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj) line 2035, I changed "npm" to "npm.cmd". And I ran into a second problem, this is the error (seems like a path resolving problem?) : ``` Building ... Installing Node.js dependencies events.js:160 throw er; // Unhandled 'error' event ^ Error: Cannot find module 'C:\DevLab\projects\npmtest\DevLabprojects pmtestoutcljs$node_modules.js' from 'C:\DevLab\projects\npmtest' at C:\DevLab\projects\npmtest\node_modules\resolve\lib\async.js:61:35 at load (C:\DevLab\projects\npmtest\node_modules\resolve\lib\async.js:80:43) at onex (C:\DevLab\projects\npmtest\node_modules\resolve\lib\async.js:105:17) at C:\DevLab\projects\npmtest\node_modules\resolve\lib\async.js:26:73 at FSReqWrap.oncomplete (fs.js:123:15) Analyzing file:/C:/DevLab/projects/npmtest/clojurescript/src/main/cljs/cljs/core.cljs Compiling src\npmtest\core.cljs Analyzing file:/C:/DevLab/projects/npmtest/clojurescript/src/main/cljs/clojure/browser/repl.cljs Analyzing file:/C:/DevLab/projects/npmtest/clojurescript/src/main/cljs/clojure/browser/net.cljs Analyzing file:/C:/DevLab/projects/npmtest/clojurescript/src/main/cljs/clojure/browser/event.cljs Analyzing file:/C:/DevLab/projects/npmtest/clojurescript/src/main/cljs/cljs/repl.cljs Analyzing file:/C:/DevLab/projects/npmtest/clojurescript/src/main/cljs/cljs/spec.cljs Analyzing file:/C:/DevLab/projects/npmtest/clojurescript/src/main/cljs/clojure/walk.cljs Analyzing file:/C:/DevLab/projects/npmtest/clojurescript/src/main/cljs/cljs/spec/impl/gen.cljs Analyzing file:/C:/DevLab/projects/npmtest/clojurescript/src/main/cljs/clojure/string.cljs Exception in thread "main" clojure.lang.ExceptionInfo: failed compiling file:src\npmtest\core.cljs {:file #object[java.io.File 0x1a7f2d34 "src\\npmtest \\core.cljs"]}, compiling:(C:\DevLab\projects\npmtest\scripts\build.clj:5:1) at clojure.lang.Compiler.load(Compiler.java:7391) at clojure.lang.Compiler.loadFile(Compiler.java:7317) at clojure.main$load_script.invokeStatic(main.clj:275) at clojure.main$script_opt.invokeStatic(main.clj:335) at clojure.main$script_opt.invoke(main.clj:330) at clojure.main$main.invokeStatic(main.clj:421) at clojure.main$main.doInvoke(main.clj:384) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.lang.Var.invoke(Var.java:379) at clojure.lang.AFn.applyToHelper(AFn.java:154) at clojure.lang.Var.applyTo(Var.java:700) at clojure.main.main(main.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93) at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:207) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93) at clojure.lang.Reflector.invokeStaticMethod(Reflector.java:207) at user$eval5.invokeStatic(form-init7915992400020498856.clj:1) at user$eval5.invoke(form-init7915992400020498856.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6927) at clojure.lang.Compiler.eval(Compiler.java:6917) at clojure.lang.Compiler.load(Compiler.java:7379) at clojure.lang.Compiler.loadFile(Compiler.java:7317) at clojure.main$load_script.invokeStatic(main.clj:275) at clojure.main$init_opt.invokeStatic(main.clj:277) at clojure.main$init_opt.invoke(main.clj:277) at clojure.main$initialize.invokeStatic(main.clj:308) at clojure.main$null_opt.invokeStatic(main.clj:342) at clojure.main$null_opt.invoke(main.clj:339) at clojure.main$main.invokeStatic(main.clj:421) at clojure.main$main.doInvoke(main.clj:384) at clojure.lang.RestFn.invoke(RestFn.java:421) at clojure.lang.Var.invoke(Var.java:383) at clojure.lang.AFn.applyToHelper(AFn.java:156) at clojure.lang.Var.applyTo(Var.java:700) at clojure.main.main(main.java:37) Caused by: clojure.lang.ExceptionInfo: failed compiling file:src\npmtest\core.cljs {:file #object[java.io.File 0x1a7f2d34 "src\\npmtest\\core.cljs"]} at clojure.core$ex_info.invokeStatic(core.clj:4617) at clojure.core$ex_info.invoke(core.clj:4617) at cljs.compiler$compile_file$fn__3865.invoke(compiler.cljc:1443) at cljs.compiler$compile_file.invokeStatic(compiler.cljc:1408) at cljs.compiler$compile_file.invoke(compiler.cljc:1384) at cljs.closure$compile_file.invokeStatic(closure.clj:488) at cljs.closure$compile_file.invoke(closure.clj:479) at cljs.closure$eval5655$fn__5656.invoke(closure.clj:557) at cljs.closure$eval5591$fn__5592$G__5580__5599.invoke(closure.clj:441) at cljs.closure$compile_sources$iter__5791__5795$fn__5796.invoke(closure.clj:905) at clojure.lang.LazySeq.sval(LazySeq.java:40) at clojure.lang.LazySeq.seq(LazySeq.java:49) at clojure.lang.Cons.next(Cons.java:39) at clojure.lang.RT.next(RT.java:688) at clojure.core$next__4341.invokeStatic(core.clj:64) at clojure.core$dorun.invokeStatic(core.clj:3033) at clojure.core$doall.invokeStatic(core.clj:3039) at clojure.core$doall.invoke(core.clj:3039) at cljs.closure$compile_sources.invokeStatic(closure.clj:899) at cljs.closure$compile_sources.invoke(closure.clj:888) at cljs.closure$build.invokeStatic(closure.clj:2281) at cljs.closure$build.invoke(closure.clj:2213) at cljs.build.api$build.invokeStatic(api.clj:202) at cljs.build.api$build.invoke(api.clj:189) at cljs.build.api$build.invokeStatic(api.clj:192) at cljs.build.api$build.invoke(api.clj:189) at user$eval6481.invokeStatic(build.clj:6) at user$eval6481.invoke(build.clj:5) at clojure.lang.Compiler.eval(Compiler.java:6927) at clojure.lang.Compiler.load(Compiler.java:7379) ... 42 more Caused by: clojure.lang.ExceptionInfo: No such namespace: left-pad, could not locate left_pad.cljs, left_pad.cljc, or Closure namespace "left-pad" in f ile src\npmtest\core.cljs {:tag :cljs/analysis-error} at clojure.core$ex_info.invokeStatic(core.clj:4617) at clojure.core$ex_info.invoke(core.clj:4617) at cljs.analyzer$error.invokeStatic(analyzer.cljc:645) at cljs.analyzer$error.invoke(analyzer.cljc:641) at cljs.analyzer$error.invokeStatic(analyzer.cljc:643) at cljs.analyzer$error.invoke(analyzer.cljc:641) at cljs.analyzer$analyze_deps.invokeStatic(analyzer.cljc:1894) at cljs.analyzer$analyze_deps.invoke(analyzer.cljc:1870) at cljs.analyzer$ns_side_effects.invokeStatic(analyzer.cljc:3132) at cljs.analyzer$ns_side_effects.invoke(analyzer.cljc:3127) at cljs.analyzer$analyze_STAR_$fn__2775.invoke(analyzer.cljc:3224) at clojure.lang.PersistentVector.reduce(PersistentVector.java:341) at clojure.core$reduce.invokeStatic(core.clj:6544) at clojure.core$reduce.invoke(core.clj:6527) at cljs.analyzer$analyze_STAR_.invokeStatic(analyzer.cljc:3224) at cljs.analyzer$analyze_STAR_.invoke(analyzer.cljc:3214) at cljs.analyzer$analyze.invokeStatic(analyzer.cljc:3242) at cljs.analyzer$analyze.invoke(analyzer.cljc:3226) at cljs.compiler$emit_source.invokeStatic(compiler.cljc:1279) at cljs.compiler$emit_source.invoke(compiler.cljc:1259) at cljs.compiler$compile_file_STAR_$fn__3842.invoke(compiler.cljc:1353) at cljs.compiler$with_core_cljs.invokeStatic(compiler.cljc:1178) at cljs.compiler$with_core_cljs.invoke(compiler.cljc:1167) at cljs.compiler$compile_file_STAR_.invokeStatic(compiler.cljc:1342) at cljs.compiler$compile_file_STAR_.invoke(compiler.cljc:1335) at cljs.compiler$compile_file$fn__3865.invoke(compiler.cljc:1431) ... 69 more ``` -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.