GithubHelp home page GithubHelp logo

Unexpected token '(' about node-lru-cache HOT 8 CLOSED

accap3035 avatar accap3035 commented on June 10, 2024
Unexpected token '('

from node-lru-cache.

Comments (8)

isaacs avatar isaacs commented on June 10, 2024

You need a JavaScript platform that understands private class members. That's why there's an engines field in package.json.

from node-lru-cache.

marcoantoniogarcialeon77 avatar marcoantoniogarcialeon77 commented on June 10, 2024

@isaacs I'm having the same issue, this is my package.json, could you help me to understand what's happening?. Thanks in advance.

{
"name": "NAME",
"version": "1.0.0",
"description": "name",
"main": "app.js",
"scripts": {
"web": "set NODE_ENV=web&& npx nodemon src/app.js",
"dev": "set NODE_ENV=development&& npx nodemon src/app.js",
"qa": "set NODE_ENV=qa&& npx nodemon src/app.js",
"prod": "set NODE_ENV=production&& npx nodemon src/app.js",
"start": "set NODE_ENV=production&& npx nodemon src/app.js",
"sass": "node-sass -w src/scss/ -o public/css/ --recursive"
},
"keywords": [],
"author": "My NAme",
"license": "ISC",
"dependencies": {
"axios": "^0.24.0",
"body-parser": "^1.19.0",
"bootstrap": "^5.2.3",
"bootstrap-icons": "^1.10.5",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"datatables.net": "^1.13.1",
"datatables.net-dt": "^1.13.1",
"dotenv": "^10.0.0",
"ejs": "^3.1.6",
"express": "^4.18.2",
"express-session": "^1.17.3",
"file-saver": "^2.0.5",
"jquery": "^3.6.4",
"jsonwebtoken": "^9.0.0",
"morgan": "^1.10.0",
"msnodesqlv8": "^2.4.0",
"multer": "^1.4.3",
"mysql2": "^3.6.0",
"node-csv": "^0.1.2",
"node-excel-export": "^1.4.4",
"node-vault": "^0.10.2",
"request": "^2.88.2"
},
"devDependencies": {
"nodemon": "^2.0.13"
}
}

What is missing?

from node-lru-cache.

isaacs avatar isaacs commented on June 10, 2024

Put this line in your program somewhere:

console.log(process.version)

Run it in the environment where the error occurs. Inspect the output.

Observe that it is not within the stated engines range for this library.

from node-lru-cache.

brunoar86 avatar brunoar86 commented on June 10, 2024

Solução:

npm uninstall mysql2
npm install [email protected]

from node-lru-cache.

runt1me avatar runt1me commented on June 10, 2024

I'm at node version 16.20.2, mysql2 version 3.6 (using lru-cache version 8.0.5) breaks this for me as well. Downgrading to mysql2 version 3.0.0 fixes the problem as stated above since it also lowers the version of lru-cache to before the breaking change, but I can't figure out why.

From node_modules/lru-cache/package.json (v8.0.5):

"engines": {
    "node": ">=16.14"
  },

I'm fine downgrading to mysql2 v3.0.0, as it has no special impact on my particular project, but I am still curious why this is not compatible with node 16.20.2.

EDIT: looks like the issue on my system was specific to having multiple node versions installed. I had an old and a new one. Make sure to check using @isaacs suggestion with console.log(process.version), rather than running node --version at the command-line (for example if running under systemd vs. bash)

from node-lru-cache.

isaacs avatar isaacs commented on June 10, 2024

Yup. There are few certainties in software development, but if you get a syntax error, then you can guarantee it's running on a VM that doesn't understand how to interpret the syntax in question, every time. That's literally the only way to cause that error. If you think it's running on a VM that does interpret that syntax, then check all the assumptions, because one of them is incorrect, 100% guaranteed. Either it's not running what you think it is, or not running on the version you think it is, etc.

from node-lru-cache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.