# TypeError: fg.convertPathToPattern is not a function

**URL:** https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252
**Category:** General
**Tags:** uibuilder
**Created:** [22 July 2025 17:12 UTC](https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252 "2025-07-22T17:12:10Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![milhouse1](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@milhouse1](https://discourse.nodered.org/u/milhouse1)
#### Post date: [22 July 2025 17:12 UTC](https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252/1 "2025-07-22T17:12:10Z")

</div>

**Versions:**

Node-RED: v4.0.9  
Node.js: v20.19.4  
node-red-contrib-uibuilder@7.4.3

**Issue:**

I've had Node-RED running on Node.js v18 for a while now, with the last uibuilder update being 6.8.2 (if the file I'm looking at is correct). I decided to go ahead with upgrading to Node.js v20 because of the errors I was getting in npm about lack of support. The upgrade went fine and all of my nodes seemed to update cleanly, except for node-red-contrib-uibuilder.

I updated node-red-contrib-uibuilder to the latest version using Manage Palette and restarted Node-RED. After that, I found that my UIs were returning "Cannot GET /urlhere/". When I opened the admin view, I saw that there wasn't a "connected \<#\>" status under the node like there usually is. I attached a debug node and deployed. I got an error (uncaught by the catch:all error node on that tab) saying "TypeError: fg.convertPathToPattern is not a function", and the uibuilder node now had a blue status dot underneath saying "Configuring node".

I looked up convertPathToPattern in the package it's said to come from (fast-glob) and found it mentioned there, so I'm not sure why it says it doesn't exist, unless that function isn't publicly accessible.

What did I break, and how do I fix it?

EDIT: for later readers, the initial issue was solved by making a copy of my uibuilder folder and exporting a copy of my uibuilder node (i only use one), then uninstalling uibuilder in Manage Palette, then using node-red-restart, then reinstalling uibuilder, then making a new uibuilder node as a near-exact copy of the old one (the only difference being an internal read-only version number variable used for debugging). After this, I was able to copy in my old html/css/js/image files and get the page to open again, but still had other issues tht were solved starting at the solution below.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [22 July 2025 17:54 UTC](https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252/2 "2025-07-22T17:54:38Z")

</div>

An error like that often means that `fg` is not what it should be.

---

<div class="post-metadata">

### Author: ![milhouse1](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@milhouse1](https://discourse.nodered.org/u/milhouse1)
#### Post date: [22 July 2025 18:16 UTC](https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252/3 "2025-07-22T18:16:56Z")

</div>

I opened the packagejson and found that the expected versions matched. A rebuild of fast-glob and node-red-contrib-uibuilder didn't seem to faze it, either.

Also, I've noticed now that, in the palette, I'm being given the option to remove uibuilder, despite it being in use in one of my flows (perhaps because it's not getting past configuration, but I wouldn't expect that to be interpreted as a missing node).

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/1/a1dd52fafa50fa552e88ebe12fe8b99882078c2f.png)

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [22 July 2025 19:27 UTC](https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252/4 "2025-07-22T19:27:35Z")

</div>

Hi, are you getting any errors in the Node-RED Log? If so, can you please share them?

When you upgraded node.js, did you do a rebuild of your nodes? It is not uncommon for a major upgrade of node.js to require you to do that.

```auto
cd ~/.node-red
npm rebuild

```

As for what you are seeing in Node-RED's palette - there is a bug in all versions of Node-RED that fails to correctly show what nodes are present if there is a mix of nodes and plugins:

On v4.0.9:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/7/67616fe79001db8ed533de6bd2401b0debbb18ff.png)

On v4.1.0-beta2:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/f/4f7bf383ccf78ae9c91811f8ba41f56bb1b5cd1a.png)

---

<div class="post-metadata">

### Author: ![milhouse1](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@milhouse1](https://discourse.nodered.org/u/milhouse1)
#### Post date: [22 July 2025 20:12 UTC](https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252/5 "2025-07-22T20:12:58Z")

</div>

Node-RED log is minimal:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/d/4d026a1468c391a0142741d0299d5019efa2fc7b.jpeg)

I also made a backup of the uibuilder folder (and the node i had in the flow), uninstalled uibuilder, restarted Node-RED, reinstalled uibuilder, and remade the node (I did a diff check and found that they were both the same, except one had a deployedVersion of 5.0.2 while the new one had 7.4.3). Instead of returning "Cannot GET /urlhere/", it returns the page that I wanted to see, albeit without loading the SVG's inputs properly.

Using npm rebuild causes this:

```auto
npm error code 1
npm error path /home/NAMEHERE/.node-red/node_modules/cpu-features
npm error command failed
npm error command sh -c node buildcheck.js > buildcheck.gypi && node-gyp rebuild
npm error make: Entering directory '/home/NAMEHERE/.node-red/node_modules/cpu-features/build'
npm error CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_aarch64_linux_or_android.o
npm error CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_arm_linux_or_android.o
npm error CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_mips_linux_or_android.o
npm error CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_ppc_linux.o
npm error CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_freebsd.o
npm error CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_linux_or_android.o
npm error CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_macos.o
npm error CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/impl_x86_windows.o
npm error CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/filesystem.o
npm error CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/stack_line_reader.o
npm error CC(target) Release/obj.target/cpu_features/deps/cpu_features/src/string_view.o
npm error rm -f Release/obj.target/deps/cpu_features/cpu_features.a Release/obj.target/deps/cpu_features/cpu_features.a.ar-file-list; mkdir -p `dirname Release/obj.target/deps/cpu_features/cpu_features.a`
npm error ar crs Release/obj.target/deps/cpu_features/cpu_features.a @Release/obj.target/deps/cpu_features/cpu_features.a.ar-file-list
npm error COPY Release/cpu_features.a
npm error CXX(target) Release/obj.target/cpufeatures/src/binding.o
npm error make: Leaving directory '/home/NAMEHERE/.node-red/node_modules/cpu-features/build'
npm error gyp info it worked if it ends with ok
npm error gyp info using node-gyp@11.2.0
npm error gyp info using node@20.19.4 | linux | x64
npm error gyp info find Python using Python version 3.8.10 found at "/usr/bin/python3"
npm error gyp info spawn /usr/bin/python3
npm error gyp info spawn args [
npm error gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'make',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/home/NAMEHERE/.node-red/node_modules/cpu-features/build/config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/root/.cache/node-gyp/20.19.4/include/node/common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/20.19.4',
npm error gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/20.19.4/<(target_arch)/node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=/home/NAMEHERE/.node-red/node_modules/cpu-features',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error gyp info spawn make
npm error gyp info spawn args ['BUILDTYPE=Release', '-C', 'build']
npm error In file included from ../../nan/nan.h:180,
npm error from ../src/binding.cc:3:
npm error ../../nan/nan_callbacks.h:55:23: error: ‘AccessorSignature’ is not a member of ‘v8’
npm error 55 | typedef v8::Local<v8::AccessorSignature> Sig;
npm error | ^ ~~~~~~~~~~~~~~~~
npm error ../../nan/nan_callbacks.h:55:40: error: template argument 1 is invalid
npm error 55 | typedef v8::Local<v8::AccessorSignature> Sig;
npm error | ^
npm error In file included from ../src/binding.cc:1:
npm error /root/.cache/node-gyp/20.19.4/include/node/node.h:1227:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
npm error 1227 | (node::addon_register_func) (regfunc), \
npm error | ^
npm error /root/.cache/node-gyp/20.19.4/include/node/node.h:1261:3: note: in expansion of macro ‘NODE_MODULE_X’
npm error 1261 | NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
npm error | ^ ~~~~~~~~~~~~
npm error ../src/binding.cc:152:1: note: in expansion of macro ‘NODE_MODULE’
npm error 152 | NODE_MODULE(cpufeatures, init)
npm error | ^ ~~~~~~~~~~
npm error make: *** [cpufeatures.target.mk:119: Release/obj.target/cpufeatures/src/binding.o] Error 1
npm error gyp ERR! build error 
npm error gyp ERR! stack Error: `make` failed with exit code: 2
npm error gyp ERR! stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:219:23)
npm error gyp ERR! System Linux 5.15.0-139-generic
npm error gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm error gyp ERR! cwd /home/NAMEHERE/.node-red/node_modules/cpu-features
npm error gyp ERR! node -v v20.19.4
npm error gyp ERR! node-gyp -v v11.2.0
npm error gyp ERR! not ok
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-07-22T20_09_15_695Z-debug-0.log

```

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [22 July 2025 20:35 UTC](https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252/6 "2025-07-22T20:35:48Z")

</div>

> [@milhouse1](#):
>
> Node-RED log is minimal:

That isn't the node red log. Try  
`sudo journalctl -f -n 100 -u nodered -o cat`

When posting logs please copy/paste rather than screenshot.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [22 July 2025 21:27 UTC](https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252/7 "2025-07-22T21:27:13Z")

</div>

> [@milhouse1](#):
>
> 5.0.2 while the new one had 7.4.3

So looks like you are going from uibuilder v5 to v7 so do check out the breaking changes between them. 5 -\> 6 did have some changes that you need to deal with in your html file.

> [@milhouse1](#):
>
> Instead of returning "Cannot GET /urlhere/", it returns the page that I wanted to see, albeit without loading the SVG's inputs properly.

Quite likely the major node.js upgrade issue.

> [@milhouse1](#):
>
> `npm error gyp ERR! stack Error: `make` failed with exit code: 2`

Make sure that you have the build tools installed so that npm can do rebuild of binary libraries for node.js.

---

<div class="post-metadata">

### Author: ![milhouse1](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@milhouse1](https://discourse.nodered.org/u/milhouse1)
#### Post date: [23 July 2025 11:49 UTC](https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252/8 "2025-07-23T11:49:10Z")

</div>

> So looks like you are going from uibuilder v5 to v7 so do check out the breaking changes between them. 5 -\> 6 did have some changes that you need to deal with in your html file.

It looks like this was the issue. In the jump from 6 to 7, I needed to switch from uibuilderfe.min.js to uibuilder.iife.min.js and remove socket.io.js. Thank you for this, it's running cleanly now.

> Make sure that you have the build tools installed so that npm can do rebuild of binary libraries for node.js.

I checked and I have it installed, it just doesn't seem to want to cooperate on cpufeatures. It looks like it still runs regardless, though.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [23 July 2025 12:23 UTC](https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252/9 "2025-07-23T12:23:42Z")

</div>

> [@milhouse1](#):
>
> It looks like this was the issue. In the jump from 6 to 7, I needed to switch from uibuilderfe.min.js to uibuilder.iife.min.js and remove socket.io.js.

Hopefully, the days of such issues are behind us now - at least for some while. The old client library is gone for good and the new library is much simpler to use. v7 cleared out a backlog of changes that might have been breaking for a few people. The next major upgrade is likely to only really have an impact on the minimum node.js version and will likely happen in line with Node-RED upgrading to v5.

---

<div class="post-metadata">

### Author: ![Martin12](https://avatars.discourse-cdn.com/v4/letter/m/e47c2d/32.png) [@Martin12](https://discourse.nodered.org/u/Martin12)
#### Post date: [2 August 2025 07:07 UTC](https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252/10 "2025-08-02T07:07:19Z")

</div>

Not sure if it is good to reply here but I am getting the exact same error:

`[error] [uibuilder:d997a40a5731934a] TypeError: fg.convertPathToPattern is not a function`

Upgraded the following:  
Node-RED: v4.0.9 → v4.1.0  
Node.js: v20.19.3 → v20.19.4  
node-red-contrib-uibuilder@7.4.1 → 7.4.3

I already did the ‘npm rebuild’. In NodeRED it says “Configuring node” below the uibulder nodes and when I change something I am getting the Error ‘`fg.convertPathToPattern`' in the NodeRED Debug area. When I try to access the Website-URL I only get a ‘Cannot GET /website/’ message.

EDIT: I had to do the same thing to fix this issue:

> [@milhouse1](#):
>
> EDIT: for later readers, the initial issue was solved by making a copy of my uibuilder folder and exporting a copy of my uibuilder node (i only use one), then uninstalling uibuilder in Manage Palette, then using node-red-restart, then reinstalling uibuilder, then making a new uibuilder node as a near-exact copy of the old one (the only difference being an internal read-only version number variable used for debugging). After this, I was able to copy in my old html/css/js/image files and get the page to open again, but still had other issues tht were solved starting at the solution below.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [2 August 2025 10:50 UTC](https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252/11 "2025-08-02T10:50:23Z")

</div>

> [@Martin12](#):
>
> I already did the ‘npm rebuild’.

You only need to rebuild when switching node.js major versions.

> [@Martin12](#):
>
> “Configuring node” below the uibulder nodes

We really need to see more of the logs in order to make sense of them.

> [@Martin12](#):
>
> I am getting the Error ‘`fg.convertPathToPattern`' in the NodeRED Debug area.

Do you mean in the Editor or in the node-red log - if in the Editor, if you expand the error message, we can get a full traceback of where the issue comes from.

> [@Martin12](#):
>
> When I try to access the Website-URL I only get a ‘Cannot GET /website/’ message.

Yes, uibuilder has not been able to mount your instance endpoint to ExpressJS.

* * *

I don’t really have enough to go on to be able to reproduce the error from what you’ve shared.

---

<div class="post-metadata">

### Author: ![Martin12](https://avatars.discourse-cdn.com/v4/letter/m/e47c2d/32.png) [@Martin12](https://discourse.nodered.org/u/Martin12)
#### Post date: [2 August 2025 14:03 UTC](https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252/12 "2025-08-02T14:03:05Z")

</div>

> [@TotallyInformation](#):
>
> We really need to see more of the logs in order to make sense of them.

This error message was the only Error in ‘node-red-log’ when I started up NodeRED.

> [@TotallyInformation](#):
>
> Do you mean in the Editor or in the node-red log - if in the Editor, if you expand the error message, we can get a full traceback of where the issue comes from.

Whenever I changed something on the existing uibuilder-Node (e.g. just move it around and re-deploy) in the NodeRED Editor then the message that also mentioned something with an ‘fg.convertPathToPattern error’ appeared in the NodeRED Editor Debug window.

Unfortunately I didn’t expand this message and I directly went on to try the hint from the thread creator (remove and reinstall uibuilder), which fixed the error. 😆

Theres maybe one more interesting detail. If I now check the GIT version control history, there is only one single change for the uibuilder-node (that I imported back in my flow): deployedVersion was ‘5.1.1’ before and now “7.4.3”. Thats a bit strange as I was using uibuilder 7.4.1 before. Maybe just that variable didn’t get updated.

Anyway, everything is working again now. 🙂 It was just a bit strange, as I've never had to reinstall uibuilder after an update before.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [2 August 2025 15:44 UTC](https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252/13 "2025-08-02T15:44:56Z")

</div>

OK, thanks for the update anyway.

That line of code was contributed by someone else and was merged in 3 weeks ago. It was a change to make the `fgSync` function in `fs.cjs` work correctly on Windows. It is only used in 1 place. The fgSync function is only called in 2 places in the `web.cjs` library. Once to add the instance API route (`<uibRoot>/<node.url>/api/*.js`) and once to add any instance custom routes (`<uibRoot>/<node.url>/routes/*.js`) - neither of which are commonly used by people.

Are you running on Windows or Linux?

---

<div class="post-metadata">

### Author: ![Martin12](https://avatars.discourse-cdn.com/v4/letter/m/e47c2d/32.png) [@Martin12](https://discourse.nodered.org/u/Martin12)
#### Post date: [2 August 2025 16:06 UTC](https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252/14 "2025-08-02T16:06:47Z")

</div>

I am running it on a Raspberry Pi 4 (Linux 6.12.34+rpt-rpi-v8)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [16 August 2025 16:07 UTC](https://discourse.nodered.org/t/typeerror-fg-convertpathtopattern-is-not-a-function/98252/15 "2025-08-16T16:07:29Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
