Getting "cannot set the Error of undefined property" when trying to run .js simple world output hello world clojurescript

I am compiling:

(ns example.hello) (js/console.log "Hello from ClojureScript!") 

In this configuration:

 (defproject lein-cljsbuild-example "1.2.3" :plugins [[lein-cljsbuild "0.2.9"]] :cljsbuild { :builds [{ :source-path "src-cljs" :compiler { :output-to "war/javascripts/mainz.js" ; default: main.js in current directory ;:optimizations :simple :target :nodejs ;:pretty-print true }}]}) 

Which outputs a file that is too large to enter here, but gives an error:

 goog.debug.Error = function(opt_msg) { ^ TypeError: Cannot set property 'Error' of undefined at Object.<anonymous> (/Users/myuser/Clojure/cljstest/war/javascripts/mainz.js:503:18) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.runMain (module.js:492:10) at process.startup.processNextTick.process._tickCallback (node.js:244:9) 
+4
source share
2 answers

The error was resolved by reinstalling leiningen and performing a clean build.

0
source

Well, in the project configuration, you indicate that your proposal :optimizations :simple commented out. This means that it will not have Google Closure optimization, which means that the output JavaScript will not be in one sufficient file, but will be split into many files. It also means that you must explicitly include base.js from the Google Closure library.

It looks like what's going on here, although there may be another thing. I am not really familiar with the output of node.js for ClojureScript.

+2
source

Source: https://habr.com/ru/post/1445234/


All Articles