当前位置:网站首页>mongoose连接mongodb不错,显示encoding没有定义

mongoose连接mongodb不错,显示encoding没有定义

2022-08-11 05:29:00 学编程的北极熊

安装mongoose不能连接mongoDB一直没找到原因

  • 今天在node中安装了mongoose,按照流程连接mongoDB一直报错,在网上查了好多方法,都没有对应的,希望有大佬能给知道一下,不胜感激
    • 连接信息
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/mynode');
var db = mongoose.connection;

  • 报错信息
$ node mongoose11.js
F:\studyFile\mongodbData\data\node_modules\whatwg-url\dist\encoding.js:2
const utf8Encoder = new TextEncoder();
                    ^

ReferenceError: TextEncoder is not defined
    at Object.<anonymous> (F:\studyFile\mongodbData\data\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> (F:\studyFile\mongodbData\data\node_modules\whatwg-url\dist\url-state-machine.js:5:34)
    at Module._compile (internal/modules/cjs/loader.js:778:30)

希望能得到各位大佬的指点,谢谢

原网站

版权声明
本文为[学编程的北极熊]所创,转载请带上原文链接,感谢
https://blog.csdn.net/baidu_20313315/article/details/119978746