Common issues and solutions when using globlin.
If npm fails to install with build errors:
# Install build tools
npm install -g node-gyp
# On macOS
xcode-select --install
# On Windows
npm install -g windows-build-tools
# On Linux
sudo apt-get install build-essentialIf no pre-built binary exists for your platform:
# Install Rust toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Rebuild the module
npm rebuild globlinCheck these common causes:
- Wrong cwd: Ensure
cwdpoints to the correct directory - Missing dot files: Use
dot: trueto include hidden files - Case sensitivity: Use
nocase: trueon case-sensitive systems - Escaped characters: Ensure
*and?aren't escaped
// Debug: check what glob sees
const g = new Glob('**/*.js', { cwd: '/project' })
console.log('Pattern:', g.pattern)
console.log('CWD:', g.cwd)Use ignore patterns to filter:
glob('**/*.js', {
ignore: ['node_modules/**', 'dist/**']
})Globlin follows minimatch semantics, not bash:
**only matches directories (use**/*for all files)- Brace expansion is enabled by default
- Extglob patterns require different syntax
- Use more specific patterns
- Add ignore patterns for large directories
- Use
maxDepthto limit recursion - Consider
globSyncfor small directories
Use streaming for large result sets:
const stream = globStream('**/*')
stream.on('data', processFile)This is a bug. Please report it with:
- The pattern used
- Options passed
- Expected vs actual results
- Directory structure (or reproduction steps)
Ensure correct TypeScript configuration:
{
"compilerOptions": {
"moduleResolution": "node16",
"esModuleInterop": true,
"target": "ES2020"
}
}Use forward slashes in patterns:
// Correct
glob('src/**/*.js')
// May cause issues
glob('src\\**\\*.js')Or enable Windows path handling:
glob('src\\**\\*.js', { windowsPathsNoEscape: true })Control symlink behavior:
// Don't follow symlinks
glob('**/*.js', { follow: false })
// Follow all symlinks
glob('**/*.js', { follow: true })If you're still having issues:
- Check existing issues: https://github.com/globlin/globlin/issues
- Create a minimal reproduction
- File a new issue with:
- Node.js version
- Platform (OS, architecture)
- globlin version
- Pattern and options
- Expected vs actual behavior