ReferenceError: TextEncoder is not defined
See original GitHub issueRelative from: https://github.com/Automattic/mongoose/issues/10713
In https://github.com/jsdom/whatwg-url/blob/master/src/encoding.js line 2 says:
"use strict";
const utf8Encoder = new TextEncoder();
const utf8Decoder = new TextDecoder("utf-8", { ignoreBOM: true });
But node show an error message:
/app/node_modules/whatwg-url/dist/encoding.js:2
const utf8Encoder = new TextEncoder();
^
ReferenceError: TextEncoder is not defined
at Object.<anonymous> (/app/node_modules/whatwg-url/dist/encoding.js:2:21)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/app/node_modules/whatwg-url/dist/url-state-machine.js:5:34)
at Module._compile (internal/modules/cjs/loader.js:778:30)
My node version:
$ node -v
v14.17.5
$ npm -v
6.14.14
The version in package.json of dependency is:
{
"_from": "whatwg-url@^9.1.0",
"_id": "whatwg-url@9.1.0",
I installed from mongoose
package but have last version of whatwg-url
package.
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (2 by maintainers)
Top Results From Across the Web
ReferenceError: TextEncoder is not defined - Stack Overflow
This issue occurs in node 10 or lower version only. To resolve this issue upgrade node version to 12 or higher and then...
Read more >Node.js TextEncoder - GeeksforGeeks
The TextEncoder class does not inherit any property. Only one property is defined which is: TextEncoder.prototype.encoding: It is a read-only ...
Read more >const utf8Encoder = new TextEncoder(); mongoose
/app/node_modules/whatwg-url/dist/encoding.js:2 const utf8Encoder = new TextEncoder(); ^ ReferenceError: TextEncoder is not defined at Object.
Read more >Javascript – ReferenceError: TextEncoder is not defined
I'm writing a simple addon in Firefox – 24, on Linux. I get the error: ReferenceError: TextEncoder is not defined. when I do:...
Read more >Shopify-cli app "TextEncoder is not defined" error
... from /home/worm/Shopify_apps/seo-dev/.env ┃ (node:63571) UnhandledPromiseRejectionWarning: ReferenceError: TextEncoder is not defined.
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 need to provide an example that only uses whatwg-url, no other packages, that we can run with
node test.js
.The same issue on the nodejs v16.13.0