getting "window is not defined" error with nodejs.
See original GitHub issueGetting “ReferenceError: window is not defined” when using with nodejs. Below given is my approach.
var mergeImages = require("merge-images");
mergeImages([
{ src: image1.buffer },
{ src: image2.buffer }
]).then(b64 => {
console.log(b64);
});
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
ReferenceError : window is not defined at object. <anonymous ...
window object is present only in the context of browser. When running application on nodejs no window object is available.
Read more >How To Solve ReferenceError window is not defined in ...
js application and still receive this error, it is because the window object does not actually exist in a Node.js environment. To resolve...
Read more >[Solved] ReferenceError : window is not defined - ItsJavaScript
The ReferenceError : window is not defined error mainly occurs if you are using the window object in Node.js, React.js, Next.js.
Read more >referenceerror: window is not defined, how to solve
Here's how to fix the “referenceerror: window is not defined” error that you might have in Node.js or with a tool like Next.js....
Read more >ReferenceError: window is not defined in JavaScript
The "ReferenceError: window is not defined" error occurs for multiple reasons: ... The window object represents a window containing a DOM document and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can solve this by using:
Info from the readme here: https://www.npmjs.com/package/merge-images#nodejs-usage
Actually, i changed my code as below:
But getting an error:
Image is not a constructor at /srv/node_modules/merge-images/dist/index.umd.js:39:13 at new Promise (<anonymous>) at /srv/node_modules/merge-images/dist/index.umd.js:32:54 at Array.map (<anonymous>) at /srv/node_modules/merge-images/dist/index.umd.js:32:23 at new Promise (<anonymous>) at mergeImages (/srv/node_modules/merge-images/dist/index.umd.js:21:9)
Some one please help asap.
Thanks, Kapil