After downloading a working codebase I started seeing the following error:
Error: Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at Function.glob.hasMagic (C:\Users\juanma\AppData\Roaming\nvm\v12.22.1\node_modules\@forge\cli\node_modules\glob\glob.js:110:30)
at FileSystemReader.hasGlobSpecialChars (C:\Users\juanma\AppData\Roaming\nvm\v12.22.1\node_modules\@forge\cli\node_modules\@forge\cli-shared\out\file-system\file-system-reader.js:56:23)
Is there anyone seeing the same?
I also tested with 1.3.3 and latest LTS Node (14) but lint still fails. I’m resorting to forge deploy --no-verify
in the meantime, which lets me deploy the app.
2 Likes
Hi @jmlunalopez ,
I have Forge CLI v1.3.4 and don’t see the issue. Which CLI commands are you getting this for?
Regards,
Dugald
Thanks for your reply @dmorrow. I’m getting the error while running forge deploy
Thanks @jmlunalopez , I’ll reach out to the Forge team to see if they can help you.
1 Like
Hi @jmlunalopez, do you have a verbose error log of your failed deploy? Can you also check if the app successfully deploys on either newer or older versions of the CLI?
Hey guys, thanks for the responses.
The verbose log of forge lint, which seems to be the failing step, is as follows:
Error: Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at Function.glob.hasMagic (C:\Users\juanma\AppData\Roaming\nvm\v12.22.1\node_modules\@forge\cli\node_modules\glob\glob.js:110:30)
at FileSystemReader.hasGlobSpecialChars (C:\Users\juanma\AppData\Roaming\nvm\v12.22.1\node_modules\@forge\cli\node_modules\@forge\cli-shared\out\file-system\file-system-reader.js:59:23)
at C:\Users\juanma\AppData\Roaming\nvm\v12.22.1\node_modules\@forge\cli\node_modules\@forge\cli-shared\out\shared\read-app-config-files.js:13:30
at Array.map (<anonymous>)
at Object.exports.listGitIgnoreFiles (C:\Users\juanma\AppData\Roaming\nvm\v12.22.1\node_modules\@forge\cli\node_modules\@forge\cli-shared\out\shared\read-app-config-files.js:12:82)
at LintService.run (C:\Users\juanma\AppData\Roaming\nvm\v12.22.1\node_modules\@forge\cli\out\service\lint-service.js:13:49)
at LintController.run (C:\Users\juanma\AppData\Roaming\nvm\v12.22.1\node_modules\@forge\cli\out\command-line\controller\lint-controller.js:11:50)
at C:\Users\juanma\AppData\Roaming\nvm\v12.22.1\node_modules\@forge\cli\out\command-line\register-lint-command.js:13:30
at Command.actionProcessor (C:\Users\juanma\AppData\Roaming\nvm\v12.22.1\node_modules\@forge\cli\out\command-line\command.js:74:38)
I can deploy on 1.3.3, 1.3.4 and 1.4.0 if I bypass the linter using forge deploy --no-verify
.
Please let me know if testing under other Node / Forge versions would be helpful in order to debug 
3 Likes
The error persists when using forge tunnel
which makes iterating over backend code slow (as I have to forge deploy
on every change.
Here’s a log from forge tunnel
:
=== Running forge lint...
(node:7) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined
at Function.glob.hasMagic (/tunnel/node_modules/glob/glob.js:110:30)
at FileSystemReader.hasGlobSpecialChars (/tunnel/node_modules/@forge/cli-shared/out/file-system/file-system-reader.js:59:23)
at /tunnel/node_modules/@forge/cli-shared/out/shared/read-app-config-files.js:13:30
at Array.map (<anonymous>)
at Object.exports.listGitIgnoreFiles (/tunnel/node_modules/@forge/cli-shared/out/shared/read-app-config-files.js:12:82)
at runLinter (/tunnel/node_modules/@forge/bundler/out/webpack.js:281:32)
at /tunnel/node_modules/@forge/tunnel/out/tunnelling/command/interactors/tunnel-interactor.js:42:31
at /tunnel/node_modules/@forge/bundler/out/webpack.js:305:13
at AsyncSeriesHook.eval [as callAsync] (eval at create (/tunnel/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:5:1)
at AsyncSeriesHook.lazyCompileHook (/tunnel/node_modules/tapable/lib/Hook.js:154:20)
at Watching._go (/tunnel/node_modules/webpack/lib/Watching.js:41:32)
at /tunnel/node_modules/webpack/lib/Watching.js:33:9
at Compiler.readRecords (/tunnel/node_modules/webpack/lib/Compiler.js:529:11)
at new Watching (/tunnel/node_modules/webpack/lib/Watching.js:30:17)
at Compiler.watch (/tunnel/node_modules/webpack/lib/Compiler.js:244:10)
at Object.exports.watch (/tunnel/node_modules/@forge/bundler/out/webpack.js:308:30)
(node:7) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:7) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Any help on how to fix / bypass would be greatly appreciated.
Hey not sure if it works for you but it helped me in another project.
I had to change the line break style in my project from CRLF to LF in my .gitignore. No idea why it helped but it did for me.
10 Likes
@FilippoMatraxia thanks, you’re a lifesaver! 
We are effectively developing on OSX and Windows, and there were mixed line endings on the codebase. Following your advice (and as reference for future devs) what I ended up doing was:
# Turn off automatic line ending management by git
git config --local core.autocrlf false
# Refresh indexes & reset to apply changes
# Warning: Stash changes before doing this or they'll be lost!
git rm --cached -r .
git reset --hard
Afterwards, I used VSCode’s Change All End Of Line Sequence extension to ensure that all of my project files ended on LF.
After this, forge lint
and subsequently forge deploy
and forge tunnel
now work as intended.
11 Likes
Thanks 
This Configuring Git to handle line endings article work for me.
Remember to use *.sln text eol=lf
.
Regards, Michal
It helped me to resolve the same issue. Thanks.