Node.js new Image() is not defined
See original GitHub issueNode.js v4.2.4
var QRC = require('qrcode-reader');
var reader = new QRC();
reader.callback = function(result){
console.log(result);
};
reader.decode("alice_shocked.png");
Result: ** ReferenceError: Image is not defined at decode … qrcode-reader\dist\index.js:2326**
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:19 (8 by maintainers)
Top Results From Across the Web
ReferenceError: Image is not defined - Stack Overflow
This gives me a ReferenceError: Image() is not defined. If I try to use document.createElement("img"); it says "document is not defined". How ...
Read more >Getting the "img not defined" reference error in the console
In "fetchBreedImage", a variable named "image" is defined; but references are made to "img", which is not defined. And to make it easier...
Read more >How to fix "require is not defined" in JavaScript / Node.js?
Learn what is "require-is-not-defined" error in JavaScript, when they occur, and how you can fix it in both browser and Node.js environment.
Read more >Image JavaScript and Node.js code examples - Tabnine
Best JavaScript code snippets using Image(Showing top 15 results out of 4,743) ; function loadImage(image) { return new Promise((resolve) => { if (typeof...
Read more >Creating and saving images with node-canvas - LogRocket Blog
Did you know you can use Node.js to generate a meta image for some pieces of content, like a blog post? Learn more...
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
See this : https://github.com/edi9999/jsqrcode/issues/17#issuecomment-230093647
I don’t know exactly for now how we could be using Image from inside node, and not in the browser build.
In the meantime, you can do something like this before requiring jsqrcode:
npm install canvas
then in your code :