Mysql2 throwing lru0cache error when deploying on shared hosting

47 Views Asked by At
backend/node_modules/mysql2/node_modules/lru-cache/dist/cjs/index.js:51
    heap;
        ^

SyntaxError: Unexpected token ;
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:152:10)
    at Module._compile (module.js:605:28)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
    at Module.require (module.js:585:17)
    at require (internal/module.js:11:18)


When I am running index.js in my ssh terminal of hostinger Shared Hosting. I am creating mysql2 connection to my online db. Working fine in local machine.

When using mysql package it is automatically closing connection both in local and on server.

This is my package.json

{
  "name": myapp",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "nodemon app.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "basic-ftp": "^5.0.3",
    "cookie-parser": "^1.4.6",
    "cors": "^2.8.5",
    "express": "^4.18.2",
    "ftp": "^0.3.10",
    "jsonwebtoken": "^9.0.2",
    "lru-cache": "^10.1.0",
    "multer": "^1.4.5-lts.1",
    "mysql": "^2.18.1",
    "mysql2": "^3.0.0",
    "nodemon": "^3.0.1"
  }
}


I want a solution to run it on server. Even tried deleting node_modules and package-lock.json and reinstalling

0

There are 0 best solutions below