Forge Currency Exchange example - Error: Cannot read properties of undefined (reading 'length')


I’m trying to follow this example Forge app and I can’t seem to deploy the app to my cloud instance.

I’ve registered the app, run ‘npm install’ as per the instructions but when I try to run ‘forge deploy’ I run into the following error:

Error: Cannot read properties of undefined (reading 'length')

TypeError: Cannot read properties of undefined (reading 'length')
    at Function.glob.hasMagic (C:\Users\Admin\AppData\Roaming\npm\node_modules\@forge\cli\node_modules\glob\glob.js:107:30)
    at FileSystemReader.hasGlobSpecialChars (C:\Users\Admin\AppData\Roaming\npm\node_modules\@forge\cli\node_modules\@forge\cli-shared\out\file-system\file-system-reader.js:59:23)
    at C:\Users\Admin\AppData\Roaming\npm\node_modules\@forge\cli\node_modules\@forge\cli-shared\out\shared\read-app-config-files.js:13:30
    at (<anonymous>)
    at Object.exports.listGitIgnoreFiles (C:\Users\Admin\AppData\Roaming\npm\node_modules\@forge\cli\node_modules\@forge\cli-shared\out\shared\read-app-config-files.js:12:82)
    at (C:\Users\Admin\AppData\Roaming\npm\node_modules\@forge\cli\out\service\lint-service.js:13:49)
    at DeployController.verifyPreDeployment (C:\Users\Admin\AppData\Roaming\npm\node_modules\@forge\cli\out\command-line\controller\deploy-controller.js:72:56)
    at (C:\Users\Admin\AppData\Roaming\npm\node_modules\@forge\cli\out\command-line\controller\deploy-controller.js:97:24)
    at C:\Users\Admin\AppData\Roaming\npm\node_modules\@forge\cli\out\command-line\register-deployment-commands.js:14:50
    at Command.actionProcessor (C:\Users\Admin\AppData\Roaming\npm\node_modules\@forge\cli\out\command-line\command.js:76:38)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Any assistance would be appreciated

Hi @BradQ ,

This looks interesting. I tried cloning a fresh copy of the repo and followed the steps and was able to deploy without errors.

To cover all the bases, I used the following versions when I tried it out.

iragudo forge-currency-exchange-orig % forge --version
iragudo forge-currency-exchange-orig % node --version

What versions are you running on?


Hi @iragudo, thanks for the reply. I’m running 4.1.0 and 16.14.0 respectively

Hi @BradQ , I’m currently stumped with this one. Since your logs indicate that you are using a Windows machine, I spawned a Windows instance, used the same version of node and forge, ran Docker, cloned the project, and after doing all of these, I was able to successfully deploy a freshly cloned project.

Are there any other steps I’m missing?

Nope, that should be everything. This is on a fairly fresh machine too (about 2 weeks old) so there shouldn’t be much that is interfering with the setup.

For reference I’m able to create a fresh project and run forge install, deploy and tunnel on it with no issue, so I’m also kinda stumped.

So far, I don’t think there’s a problem with the sample app and this seems to be an isolated case. That said, since you can create a fresh project, you can then use the sample app as reference - copy the customFieldType module from manifest and implement (or copy) the functions that you need.

As I cannot replicate the issue, it is a bit of a challenge to diagnose a fix. My apologies.