const utf8Encoder = new TextEncoder();
ReferenceError: TextEncoder is not defined
If the current behavior is a bug, please provide the steps to reproduce.
in a clean installation run the following commands
npm i mongoose
node getting-started.js
// getting-started.js
const mongoose = require('mongoose');
main().catch(err => console.log(err));
async function main() {
await mongoose.connect('mongodb://localhost:27017/test');
What is the expected behavior?
show the error
const utf8Encoder = new TextEncoder();
ReferenceError: TextEncoder is not defined
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
node --version
v10.19.0
mongo --version
MongoDB shell version v5.0.2
Build Info: {
"version": "5.0.2",
"gitVersion": "6d9ec525e78465dcecadcff99cce953d380fedc8",
"openSSLVersion": "OpenSSL 1.1.1f 31 Mar 2020",
"modules": [],
"allocator": "tcmalloc",
"environment": {
"distmod": "ubuntu2004",
"distarch": "x86_64",
"target_arch": "x86_64"
cat package.json
"dependencies": {
"express": "^4.17.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^6.0.2",
"nodemon": "^2.0.12",
"utf8": "^3.0.0",
"whatwg-url": "^9.0.0"
"scripts": {
"start": "node index.js",
"rnodemon": "nodemon index.js"
Activity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment