0

I was working with sublime text 3 and running my code with node build system.When I have updated nodeJS to v10, the problems began.

Node Build system :

{
"cmd": ["C:/Program Files/nodejs/node.exe","$file"],
"selector": "source.js"
}

The console shows this error:

console.log(window);
        ^

ReferenceError: window is not defined
at Object.<anonymous> (C:\Users\mhsn67\Documents\Front End NanoDegree\Example\Background-generator\app.js:3:13)
at Module._compile (internal/modules/cjs/loader.js:936:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
at Module.load (internal/modules/cjs/loader.js:790:32)
at Function.Module._load (internal/modules/cjs/loader.js:703:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
at internal/main/run_main_module.js:17:11
[Finished in 0.2s]
6
  • 1
    Looks like the ST build system is using Node under the hood, but your code references window, which is part of the Browser/DOM API... Commented Sep 23, 2019 at 20:38
  • So it was not producing error before updating to v10? Commented Sep 23, 2019 at 20:43
  • Possible duplicate of ReferenceError : window is not defined at object. <anonymous> Node.js Commented Sep 23, 2019 at 20:45
  • Yes, there is not @VoidSpirit Commented Sep 23, 2019 at 20:45
  • @AliLefta because window is browser's object not Nodejs'. So if you were not having an error then you were declaring it before then Commented Sep 23, 2019 at 20:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.