Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVA requires different NODE_MODULE_VERSION #2609

Closed
MMcKester opened this issue Nov 12, 2020 · 3 comments
Closed

AVA requires different NODE_MODULE_VERSION #2609

MMcKester opened this issue Nov 12, 2020 · 3 comments

Comments

@MMcKester
Copy link

MMcKester commented Nov 12, 2020

Hi,

I use ava 3.13.0 with node 14.15.0 and Electron 10.1.5 and nodegit 0.27.0.. FYI: I also use ava-ts.

So I use ava with spectron to start my app, do some tests and stop it. All of this works - including functions which use nodegit in my app.

In addition to the tests described above I made also a pure non-Electron test file and import nodegit directly.

 import * as nodegit from 'nodegit';

Executing this test now via ava returns this:

node_modules\.pnpm\nodegit@0.27.0\node_modules\nodegit\build\Release\nodegit.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 82. This version of Node.js requires
NODE_MODULE_VERSION 83. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Module._extensions..node (internal/modules/cjs/loader.js:1122:18)

Where exactly does version 82 come from? I only have nodejs 14.15.0 installed, which uses version 83 as expected. Why does ava think the version is a mismatch where it works actually in my app? This is how my package.json looks like:

  "devDependencies": {
    "ava-ts": "0.25.2",
  },
  "scripts": {
    "ava-ts": "node_modules/.bin/ava-ts",
     ...
  },
  "ava-ts": {
    "cache": false,
    "serial": true,
    "verbose": true,
    "timeout": 10000,
    "instrument": true,
    "nodeArguments": [
      "--napi-modules",
      "--experimental-modules"
    ]
  },

I built nodegit myself and in the config.gypi file it even refers to:

    "node_module_version": 83,

Can anyone explain me if this a bug or where version 82 comes from?

@MMcKester
Copy link
Author

MMcKester commented Nov 12, 2020

I created a very simple project to reproduce it: https://github.com/Githubber2021/ava-node-version-issue

% node --version
14.15.0
% npm install
% npm run ava-ts
... error

P.S. the electron dependency is actually unused

@novemberborn
Copy link
Member

ava-ts is not an AVA project. I'd suggest you have a look at the built-in TypeScript support and use ava directly.

I believe the "node module version" is to do with native bindings. You also have an --napi-modules flag enabled for Node.js. I don't know exactly what these things do, but the error here is not due to AVA itself.

@MMcKester
Copy link
Author

MMcKester commented Nov 12, 2020

Hi! novemberborn, thank you for your input! I thought ava-ts ist just a wrapper and related to ava. I removed this dependency in my example repo. It now uses ava and TypeScript only but the issue still remains. I also used --napi-modules, but it still and only fails with ava. I will open a Stackoverflow question then. Thanks again for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants