ReferenceError: TextEncoder is not defined
See original GitHub issueHi, I used the createScript
method to create the script, while it throws the exception with the information of ReferenceError: TextEncoder is not defined
.
I use the neon-js-5.0.0-next.7
version which I expect for neo rc1.
Issue Analytics
- State:
- Created 2 years ago
- Comments:15 (7 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 >TextEncoder is not defined #209 - jsdom/whatwg-url - GitHub
You need to provide an example that only uses whatwg-url, no other packages, that we can run with node test.js . 👎 34...
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 >TextEncoder is not defined Node.js with mongoose-mongodb
[Solved]-ReferenceError: TextEncoder is not defined Node.js with mongoose-mongodb. Search. score:29. Accepted answer. Actually mongoose 6 requires Node 12 ...
Read more >Ember Builds Fail for All Ember 3.22+ apps - Support
12:49:53 AM: - originalErrorMessage: [undefined] 12:49:53 AM: - stack: ReferenceError: TextEncoder is not defined 12:49:53 AM: at Object.
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
Hi I root caused the problem to be an issue with jest and the environment. You are using jest with the default testEnvironment which is
jsdom
. There is a bug withjsdom
where TextEncoder is not available within the global namespace.neon-js
runs tests with the node environment thus we did not encounter such an issue.To fix this, you either use a node test environment or amend your global environment with the correct globals.
Yes, by specifying
--env=node
it seems to fix the TextEncoder issue.