MaibornWolff / metric-gardener

BSD 3-Clause "New" or "Revised" License
5 stars 0 forks source link

Node version problem: `npm test` does not work #323

Closed mylinhdao closed 2 months ago

mylinhdao commented 2 months ago

In package.json, we have defined the required node version to "node": ">=18". But actually, npm run test seems to only works on Node v20 (tested on v20.11.0). If I run it on Node v18.20.2, the tests could not be found. I could not find out why. So any answers and helps are very appreciated!

clemens-mw commented 2 months ago

TLDR: run npm rebuild

If you used v20 before and installed the dependencies, the install script of tree-sitter will build the node bindings using v20. If you switch to v18 afterwards you will receive the error The module was compiled against a different Node.js version. You can fix this by running npm rebuild, npm install or npm ci locally to build the dependencies again.

mylinhdao commented 2 months ago

@clemens-mw thank you very much for answering :) It works with npm rebuild and npm ci !