jestjsnodegit

How to change Jest module version for node.js 14?


I just started using JEST, I can't figure out what's wrong. I've tried reinstalling all packages and clearing the cache.

  ● Test suite failed to run

    The module '/Users/dan_kos/Documents/Work/Authorization project/admin_service/server/node_modules/nodegit/build/Release/nodegit.node'
    was compiled against a different Node.js version using
    NODE_MODULE_VERSION 83. This version of Node.js requires
    NODE_MODULE_VERSION 102. Please try re-compiling or re-installing
    the module (for instance, using `npm rebuild` or `npm install`).

      at Runtime._loadModule (node_modules/jest-runtime/build/index.js:893:29)
      at Object.<anonymous> (node_modules/nodegit/dist/nodegit.js:12:12)

Jest config:

"jest": {
    "preset": "ts-jest",
    "testEnvironment": "node",
    "transform": {
      "node_modules/variables/.+\\.(j|t)sx?$": "ts-jest"
    },
    "transformIgnorePatterns": [
      "node_modules/(?!variables/.*)"
    ]
  }```

Solution

  • It was an absolutely stupid mistake, I forgot to change the version of node.js in the WebStrom settings and it ran everything in version 17 instead of 14