Troubleshooting Guide for @knowcode/doc-builder
Overview
This guide helps you resolve common issues when using @knowcode/doc-builder. Most problems have simple solutions, and this guide covers the most frequent ones.
NPX Cache Issues
Problem
The most common issue users face is npx caching an older version of doc-builder.
Symptoms:
- Running
npx @knowcode/doc-builder
shows an old version number - New features aren't available despite updating
- Bug fixes don't appear to be working
- Version shown doesn't match npm registry
Example:
$ npx @knowcode/doc-builder@latest --version
1.4.11 # Old version!
# But npm shows:
$ npm view @knowcode/doc-builder version
1.4.22 # Latest version
Solution
# Method 1: Clear the npx cache
npx clear-npx-cache
# Method 2: Force the latest version
npx @knowcode/doc-builder@latest
# Method 3: Specify exact version
npx @knowcode/doc-builder@1.4.22
Why This Happens
NPX caches packages to improve performance, but this cache doesn't automatically update when new versions are published.
Prevention
Always use @latest for current version:
npx @knowcode/doc-builder@latest deploy
For development, install globally:
npm install -g @knowcode/doc-builder doc-builder deploy
For projects, install as dev dependency:
npm install --save-dev @knowcode/doc-builder npx doc-builder deploy # Uses local version
Build Issues
No Markdown Files Found
Error: No markdown files found in docs directory
Solutions:
Check directory structure:
ls -la docs/ # Should show .md files
Ensure correct file extensions:
-
README.md
-
guide.md
-
README.txt
-
guide.markdown
-
Use custom input directory:
npx @knowcode/doc-builder@latest build --input my-docs
Build Output Missing
Problem: HTML files not generated
Check:
- Look in
html/
directory (default output) - Check for build errors in console
- Verify markdown files are valid
Solution:
# Clean build
rm -rf html/
npx @knowcode/doc-builder@latest build
# Check output
ls -la html/
Deployment Issues
Vercel CLI Not Found
Error: Vercel CLI not found!
Solution:
# Install Vercel CLI globally
npm install -g vercel
# Verify installation
vercel --version
# Then retry deployment
npx @knowcode/doc-builder@latest deploy
Deployment Fails
Common causes:
Not Logged Into Vercel
# Login to Vercel first vercel login
Build Not Complete
# Build before deploy npx @knowcode/doc-builder@latest build npx @knowcode/doc-builder@latest deploy
Project Name Already Taken
- Choose a different project name
- Or delete the existing project in Vercel dashboard
Wrong Production URL Displayed
Problem: Deployment shows incorrect URL
Solution 1: Update to latest version
# Clear cache and update
npx clear-npx-cache
npx @knowcode/doc-builder@latest deploy
Solution 2: Set custom URL
# Set your actual production URL
npx @knowcode/doc-builder@latest set-production-url https://my-docs.vercel.app
Configuration Issues
Config File Not Loading
Symptoms:
- Default settings used instead of custom config
- Site name shows "Documentation"
Solutions:
Check file name:
-
doc-builder.config.js
-
docbuilder.config.js
-
doc-builder-config.js
-
Verify export format:
// Correct module.exports = { siteName: 'My Docs' }; // Wrong export default { siteName: 'My Docs' };
Use explicit config path:
npx @knowcode/doc-builder@latest build --config ./my-config.js
Authentication Issues
Login Page Not Working
Check:
- Authentication enabled in config
- Credentials match exactly (case-sensitive)
- Cookies enabled in browser
Debug:
// doc-builder.config.js
module.exports = {
features: {
authentication: true // Must be true
},
auth: {
username: 'admin', // Case sensitive!
password: 'secret' // Case sensitive!
}
};
Styling Issues
CSS Not Loading
Symptoms:
- Plain HTML without styling
- 404 errors for CSS files
Fixed in: v1.2.0+
Solutions:
- Update to latest version
- Check browser console for 404 errors
- Verify
html/css/
directory exists after build
Dark Mode Not Working
Check:
- Feature enabled in config
- Browser supports CSS variables
- No conflicting styles
Development Server Issues
Port Already in Use
Error: Port 3000 is already in use
Solutions:
# Use different port
npx @knowcode/doc-builder@latest dev --port 8080
# Find process using port
lsof -i :3000 # macOS/Linux
netstat -ano | findstr :3000 # Windows
Hot Reload Not Working
Common causes:
- File system events not supported
- Saving files outside watched directory
- Browser cache
Solutions:
- Hard refresh browser (Ctrl/Cmd + Shift + R)
- Check that files are in
docs/
directory - Restart dev server
Platform-Specific Issues
Windows Path Issues
Problem: Paths with backslashes cause errors
Solution: Use forward slashes or escape backslashes:
// Bad
docsDir: 'C:\Users\me\docs'
// Good
docsDir: 'C:/Users/me/docs'
// Or
docsDir: 'C:\\Users\\me\\docs'
macOS Permission Issues
Error: EACCES: permission denied
Solutions:
- Don't use sudo with npm/npx
- Fix npm permissions:
mkdir ~/.npm-global npm config set prefix '~/.npm-global' echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc source ~/.zshrc
Getting Help
Debug Information
When reporting issues, include:
Version information:
npx @knowcode/doc-builder@latest --version node --version npm --version
Error messages: Full error output
Configuration: Your
doc-builder.config.js
(remove passwords)Directory structure:
tree -L 2 # or ls -la
Support Channels
- GitHub Issues: Report bugs and feature requests
- npm Page: Check for updates and documentation
- This Guide: Reference for common problems
Quick Reference
Problem | Solution |
---|---|
Old version running | npx clear-npx-cache |
Vercel deploy fails | vercel login then retry |
No markdown found | Check docs/ directory exists |
CSS not loading | Update to latest version |
Port in use | --port 8080 |
Config not loading | Check filename and format |
404 after deploy | Check Deployment Protection settings |
Document History
Date | Version | Author | Changes |
---|---|---|---|
2025-07-21 | 1.0 | System | Initial troubleshooting guide |