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 init;
$ npm install mongoose;
$ echo "const mongoose = require('mongoose');" > index.js
$ node index.js;
What is the expected behavior?
show the error
/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)
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
$ node -v
v14.17.5
$ npm -v
6.14.14
$ sudo docker exec -it database-mongodb bash;
root@37127c24c366:/# mongo
MongoDB shell version v5.0.2
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
$ tail -13 package.json
"dependencies": {
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"joi": "^17.4.2",
"jsonwebtoken": "^8.5.1",
"mongodb": "^4.1.1",
"mongoose": "^6.0.5",
"uuid": "^8.3.2"
Reference: https://github.com/jsdom/whatwg-url/issues/209
Activity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment