添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

ReferenceError: TextEncoder is not defined #10638

Closed

Description

Do you want to request a feature or report a bug ?

What is the current behavior?

after install mongoose show me a error

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

Metadata

Assignees

No one assigned

Labels

help This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions