uhop / node-re2

node.js bindings for RE2: fast, safe alternative to backtracking regular expression engines.
Other
479 stars 53 forks source link

Add Node v20 compatibility #177

Closed bt95 closed 1 year ago

bt95 commented 1 year ago

Details

Hello!

I am using re2 (latest version - 1.19.1) and after upgrading a service to use Node v20.3.1 I get the following error:

The module '<service-path>/node_modules/re2/build/Release/re2.node'
    was compiled against a different Node.js version using
    NODE_MODULE_VERSION 111. This version of Node.js requires
    NODE_MODULE_VERSION 115. Please try re-compiling or re-installing
    the module (for instance, using `npm rebuild` or `npm install`).

NODE_MODULE_VERSION 111 => Node.js v19.0.0 NODE_MODULE_VERSION 115 => Node.js v20.3.0

Node.js version

Node.js v20.3.0

Operating system

Linux / GitLab CI/CD

Module and version

re2 v1.19.1

uhop commented 1 year ago

It is not enough to upgrade Node from 19 to 20. All binary extensions (such as re2) should be reinstalled. The simplest way to do it is to run npm i. If you want to preserve versions of your dependencies, remove node_modules/ and run npm ci. If you want to do a point update, you can remove node_modules/re2 and run npm ci.

bt95 commented 1 year ago

Thanks for the reply, @uhop! I'll try and see what can help fix the issue.

bt95 commented 1 year ago

In the end, I've solved the Gitlab CI/CD issue by adding some pnpm install re2 commands in the pipeline stages where required.

Thanks for your help!