Skip to content

Required Node config@1.31.0 throws a TypeError on MacOS 15.1 when running from source (with a sloppy fix) #176

Description

@cacology

Following the steps from the section "Running from source" calling npm start aborts with an error:

> translation-server@2.0.5 start
> node src/server.js

/Users/user/projects/translation-server/node_modules/config/lib/config.js:1217
    } else if (Utils.isRegExp(parent)) {
                     ^

TypeError: Utils.isRegExp is not a function
    at _clone (/Users/user/projects/translation-server/node_modules/config/lib/config.js:1217:22)
    at Config.cloneDeep (/Users/user/projects/translation-server/node_modules/config/lib/config.js:1255:10)
    at /Users/user/projects/translation-server/node_modules/config/lib/config.js:1515:32
    at Array.forEach (<anonymous>)
    at util.extendDeep (/Users/user/projects/translation-server/node_modules/config/lib/config.js:1492:9)
    at /Users/user/projects/translation-server/node_modules/config/lib/config.js:727:14
    at Array.forEach (<anonymous>)
    at /Users/user/projects/translation-server/node_modules/config/lib/config.js:721:14
    at Array.forEach (<anonymous>)
    at util.loadFileConfigs (/Users/user/projects/translation-server/node_modules/config/lib/config.js:720:13)

If I manually edit the offending node_modules/config/lib/config.js thus:

From

    if (Utils.isArray(parent)) {
      child = [];
    } else if (Utils.isRegExp(parent)) {
      child = new RegExp(parent.source, util.getRegExpFlags(parent));
      if (parent.lastIndex) child.lastIndex = parent.lastIndex;
    } else if (Utils.isDate(parent)) {

To

    if (Utils.types.isArray(parent)) {
[...]
    } else if (Utils.types.isDate(parent)) {

Everything seems to work fine. I think this is probably a bug in config or something, but I'm not very knowledgeable about how to work with npm packages. Could updating the version of config required fix the problem?

uname -v: Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:23 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T6031

npm -v: 10.9.0

node -v v23.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions