Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

226
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!