isaacs / node-lru-cache

A fast cache that automatically deletes the least recently used items
http://isaacs.github.io/node-lru-cache/
ISC License
5.38k stars 353 forks source link

Issue with lru-cache npm module: Unexpected token error and unresolved problems #311

Closed 7AkhilV closed 1 year ago

7AkhilV commented 1 year ago

I have been encountering issues with the lru-cache npm module in my Node.js project. Despite attempting various troubleshooting steps, I am unable to resolve the problem. The specific error message I am encountering is as follows:

/home/akhil/Documents/coding/sql/node_modules/lru-cache/dist/cjs/index.js:359
    #initializeTTLTracking() {
                          ^
SyntaxError: Unexpected token '('

Steps I have already taken include:

  1. Deleting the node_modules directory and reinstalling dependencies using npm install.
  2. Clearing the npm cache and updating npm to the latest version.
  3. Checking for compatibility issues between the lru-cache module and Node.js version.
  4. Verifying compatibility among other project dependencies.
  5. Reviewing application logs for additional error messages or warnings.

Despite these efforts, the issue remains unresolved. I suspect there may be an inherent problem with the lru-cache module itself.

Could anyone provide guidance on how to resolve this issue?

isaacs commented 1 year ago

What node version are you using?

7AkhilV commented 1 year ago

node version - v18.16.1

isaacs commented 1 year ago

Tests pass on v18.16.1. I don't believe that's the version running. You must have a node version that doesn't support private class properties with #, or you wouldn't be getting that error.

Can you reproduce it locally, or is this just in a deployment environment?

7AkhilV commented 1 year ago

I got this issue with MySQL database, so I switched to MongoDB. Since making the transition, the error has been resolved. I am currently running this setup on my local environment.