Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

225
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda