question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Window isn't defined. NODE JS

See original GitHub issue

I did sudo npm install jspdf to install the package dependencies.

var doc = require('jspdf');
doc.text(20, 20, 'Hello world.');
doc.save('assets/stickers/1.pdf');

Got an error in the console

ReferenceError: window is not defined at /Users/narangrishab/Desktop/yumist/base/node_modules/jspdf/dist/jspdf.min.js:280:23027 at Object.<anonymous> (/Users/narangrishab/Desktop/yumist/base/node_modules/jspdf/dist/jspdf.min.js:287:29670) at Module._compile (module.js:409:26) at Object.Module._extensions…js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Function.cls_wrapMethod (/Users/narangrishab/Desktop/yumist/base/node_modules/newrelic/lib/shimmer.js:246:38) at Function._load (/Users/narangrishab/Desktop/yumist/base/node_modules/pmx/lib/transaction.js:62:21) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object.q.drain (/Users/narangrishab/Desktop/yumist/base/api/controllers/v1/BowlController.js:129:25) at next (/Users/narangrishab/Desktop/yumist/base/node_modules/sails/node_modules/async/lib/async.js:801:31) at /Users/narangrishab/Desktop/yumist/base/node_modules/sails/node_modules/async/lib/async.js:32:16 at gm.eval (eval at <anonymous> (/Users/narangrishab/Desktop/yumist/base/api/controllers/v1/BowlController.js:102:20), <anonymous>:1:491) at cb (/Users/narangrishab/Desktop/yumist/base/node_modules/gm/lib/command.js:318:16) at ChildProcess.proc.on.onExit (/Users/narangrishab/Desktop/yumist/base/node_modules/gm/lib/command.js:301:9)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
Uzlopakcommented, Sep 22, 2017

Refactored acroform.js, PR #1454

0reactions
Uzlopakcommented, Feb 17, 2018

Made a general nodejs-compatibility issue #1533 Closing this to concentrate the problems into one issue

Duplicate of #1533

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
ReferenceError: window is not defined in JavaScript
The "ReferenceError: window is not defined" error occurs for multiple reasons: ... The window represents a window containing a DOM document and is...
Read more >
ReferenceError : window is not defined at object. <anonymous ...
In my web I have 3 JavaScript files : client.js , server.js , myModule.js . In client.js I create a window variable called...
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 >
[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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found