magomimmo / modern-cljs

A series of tutorials on ClojureScript
2.93k stars 289 forks source link

ReferenceError: window is not defined - tutorial 16 second edition #338

Open learningcljs opened 8 years ago

learningcljs commented 8 years ago

In tutorial 16 when I do:

boot tdd -e node

I get this error message:

Starting reload server on ws://localhost:55219
Writing boot_reload.cljs...
Writing boot_cljs_repl.cljs...
2016-04-03 19:18:55.191:INFO::clojure-agent-send-off-pool-0: Logging initialized @75243ms
2016-04-03 19:19:29.343:INFO:oejs.Server:clojure-agent-send-off-pool-0: jetty-9.2.10.v20150310
2016-04-03 19:19:29.491:INFO:oejs.ServerConnector:clojure-agent-send-off-pool-0: Started ServerConnector@75808dd9{HTTP/1.1}{0.0.0.0:3000}
2016-04-03 19:19:29.494:INFO:oejs.Server:clojure-agent-send-off-pool-0: Started @109546ms
Started Jetty on http://localhost:3000

Starting file watcher (CTRL-C to quit)...

nREPL server started on port 50680 on host 127.0.0.1 - nrepl://127.0.0.1:50680
Writing clj_test/suite.cljs...
Writing main.cljs.edn...
Compiling ClojureScript...
• main.js
Running cljs tests.../path-to/modern-cljs/kag/f0sqpx/main.out/adzerk/boot_reload/reload.js:8
adzerk.boot_reload.reload.page_uri = (new goog.Uri(window.location.href));
                                                                                      ^
ReferenceError: window is not defined
    at Object.<anonymous> (/path-to/modern-cljs/kag/f0sqpx/main.out/adzerk/boot_reload/reload.js:8:52)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at global.CLOSURE_IMPORT_SCRIPT (/path-to/modern-cljs/kag/f0sqpx/main.out/goog/bootstrap/nodejs.js:75:3)
    at Object.goog.importScript_ (/path-to/modern-cljs/kag/f0sqpx/main.out/goog/base.js:879:9)
    at Object.goog.writeScripts_ (/path-to/modern-cljs/kag/f0sqpx/main.out/goog/base.js:1321:16)

Testing modern-cljs.shopping.validators-test

Ran 1 tests containing 13 assertions.
0 failures, 0 errors.
Writing target dir(s)...
Elapsed time: 123.761 sec

It is my understanding that node.js does not have a window object.

magomimmo commented 8 years ago

yep. modern-cljs is for browser only, not for node.js. It's not impossible that in the future I'll create a new series for nodejs, because I'm working hard on a cljs project which uses nodejs,