Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import gitignore from 'glob-fs-gitignore'
✗ const { gitignore } = require('glob-fs-gitignore')
The default export is a function. In CommonJS, use require('glob-fs-gitignore') directly.
default (CommonJS)
✓ const gitignore = require('glob-fs-gitignore')
✗ const gitignore = require('glob-fs-gitignore').default
CommonJS require returns the function directly; no .default needed.
TypeScript usage
✓ import gitignore from 'glob-fs-gitignore'
✗ import * as gitignore from 'glob-fs-gitignore'
The module has no type definitions; use @types/glob-fs-gitignore or declare module.
Demonstrates using glob-fs-gitignore middleware to ignore .gitignore patterns while globbing.
const glob = require('glob-fs')({ dotfiles: true });
const gitignore = require('glob-fs-gitignore');
glob.use(gitignore())
.readdir('**/*', function(err, files) {
if (err) throw err;
console.log(files);
});
Errors
Common errors & fixes
TypeError: gitignore is not a function
Importing incorrectly in CommonJS, e.g., const { gitignore } = require('glob-fs-gitignore') when the module exports a function directly.
fixUse const gitignore = require('glob-fs-gitignore'); Cannot find module 'glob-fs-gitignore'
The package is not installed or is missing from node_modules. Also ensure glob-fs is installed as a peer dependency.
fixRun npm install glob-fs-gitignore glob-fs
Audit
Dependencies
glob-fsrequiredPeer dependency; this middleware requires glob-fs to function.