Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When i am making live my server its giving error #366

Open
Ahahrukh opened this issue Jul 21, 2024 · 1 comment
Open

When i am making live my server its giving error #366

Ahahrukh opened this issue Jul 21, 2024 · 1 comment

Comments

@Ahahrukh
Copy link

Uploading Screenshot 2024-07-21 173735.png…

@chrisroode
Copy link

Hello! I just saw this issue, and I don't see the screen shot, but it sounds similar to a problem I am having. I just installed QRCode on my server to test it out and right out of the box, when running a Jest Test, it came back with the following error:

ReferenceError: TextEncoder is not defined
at new ByteData (./node_modules/qrcode/lib/core/byte-data.js:6:21)
at buildSingleSegment (./node_modules/qrcode/lib/core/segments.js:262:14)
at ./node_modules/qrcode/lib/core/segments.js:286:16
at Array.reduce ()

When I looked at the source file byte-data.js, I noticed that line 6 or 7 references TextEncoder() as a global constant.

I added on line 2:
const util = require('util')

and changed line (6 or 7) to
this.data = new util.TextEncoder().encode(data)

And the code stopped crashing. I know my hot fix is going to lead to deployment issues, and I am not sure much more of the working of this package, but I would be willing to help work on this issue, just might need a little guidance. I would rather use the dependency directly than making a personal fork, fixing, and throwing it in my codebase somewhere.

Is this an issue others are facing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants