Window is not defined in node.js, sigma.js and typescript environment

Solution 1:

Well, no, it isn't.

Express.js is a server-side framework for generating responses to HTTP requests. It runs on Node.js. It doesn't have a window.

Sigma is a graphing library designed to be run by a web browser when it is embedded in a webpage (via a <script> element). It works by manipulating the DOM of that webpage.

It isn't compatible with Node.js or Express.js.


The existence of a package on NPM shouldn't be taken to mean that a module is compatible with Node.js. Many modules there are designed to be used in web browsers by applications which use NPM to manage their dependencies. (These are typically applications written using a SPA framework like React, Angular or Vue which bundle the modules they depend on using tools like Webpack or Parcel).