uhop / node-re2

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

Cannot find module './build/Release/re2' from 'node_modules/re2/re2.js' #112

Closed regexj closed 2 years ago

regexj commented 2 years ago
Test suite failed to run

    Cannot find module './build/Release/re2' from 'node_modules/re2/re2.js'

    Require stack:
      node_modules/re2/re2.js
      node_modules/url-regex-safe/lib/index.js
      node_modules/get-urls/index.js

When running a jest unit test (typescript) the above error is thrown.

The error stack trace originates from get-urls the current version of which is using an older version of url-regex-safe.

However, after forking and updating this in get-urls: https://github.com/regexj/get-urls the error from jest persists.

Any ideas?

uhop commented 2 years ago

I am just curious: what was the reason?

j-d-carmichael commented 2 years ago

Jest required that in order to execute the file with ext of .node it should be specified in the jest config eg:

module.exports = {
  moduleFileExtensions: [
    'js',
    'json',
    'node',
    'ts',
  ],
uhop commented 2 years ago

I’ll add it to the wiki.