Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

227
Visualizações
Running Project mongodb using Vps not work

I am running my project on VPS and getting error but http://localhost:3000/ it work, trying uninstall and install npm mongodb but it not work.

remove require('mongodb') it work on VPS, but i can't use mongodb.

/Rest_api_2/node_modules/whatwg-url/dist/encoding.js:2
const utf8Encoder = new TextEncoder();
                    ^

ReferenceError: TextEncoder is not defined
    at Object.<anonymous> (Rest_api_2/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> (Rest_api_2/node_modules/whatwg-url/dist/url-state-machine.js:5:34)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! rest_api_2@1.0.0 start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the rest_api_2@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-08-29T14_07_03_848Z-debug.log

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

i have temporary solution for it i dont know is it bug or what but to make your code work right now what i did is in package.json i change mongoose version to 5.13.7 something like this

"mongoose": "^5.13.7"

and then deleted node_modules and ran command npm install to reinstall node_modules with old version and then my code ran

EDIT:As i said its temporary solution i figured out permanent solution by some googling its actually with the new version of mongoose need new version of nodejs so you just need to update node js and npm to make it work and its permanent solution dont just downgrade and use it was temporary from mongoose version 5.13.7 to latest version they have fixed some vulnerabilities so i suggest the best thing is to just update node js and npm and use the latest mongoose version.

over 4 years ago · Santiago Trujillo Relatório

0

Here you go! Try to add this line at starting in your encoding.js file

let { TextEncoder, TextDecoder } = require("util");

Method-2 Better You update your npm and Nodejs

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda