Common Issues
This page documents common problems and their solutions. Issues are organized by category for easy reference.
Build Errors
Cannot find module ‘X’
Symptoms:
Error: Cannot find module 'markdown-it'
Error: Cannot find module 'gray-matter'
Error: Cannot find module 'chokidar'
Cause: Dependencies are not installed.
Solution:
npm install
If that does not work, try a clean install:
rm -rf node_modules package-lock.json
npm install
ENOENT: no such file or directory
Symptoms:
Error: ENOENT: no such file or directory, open 'content/xyz.md'
Error: ENOENT: no such file or directory, open 'templates/base.html'
Cause: A file or directory that the build script expects is missing.
Solution:
-
Verify you are in the correct directory:
pwd # Should show your MarkStack project folder ls # Should show content/, templates/, build.js, etc. -
If
content/is missing, create it:mkdir content -
If
templates/base.htmlis missing, you may need to restore it from version control or reinstall MarkStack.
SyntaxError in siteconfig.json
Symptoms:
SyntaxError: Unexpected token } in JSON at position 123
Warning: Could not parse siteconfig.json, using defaults
Cause: Invalid JSON syntax in the configuration file.
Solution:
-
Open
siteconfig.jsonand check for:- Missing commas between properties
- Trailing commas after the last property
- Unquoted strings
- Single quotes instead of double quotes
-
Validate your JSON:
node -e "console.log(JSON.parse(require('fs').readFileSync('siteconfig.json')))" -
Use a JSON validator online or in your editor.
Correct format:
{
"siteTitle": "My Site",
"siteUrl": "https://example.com"
}
Common mistakes:
{
"siteTitle": "My Site", // Trailing comma - WRONG
}
{
siteTitle: "My Site" // Unquoted key - WRONG
}
{
"siteTitle": 'My Site' // Single quotes - WRONG
}
Invalid YAML frontmatter
Symptoms:
YAMLException: bad indentation of a mapping entry
YAMLException: can not read a block mapping entry
Cause: Syntax error in the YAML frontmatter of a markdown file.
Solution:
-
Check the frontmatter uses correct YAML syntax:
--- title: My Page Title description: A description of this page --- -
Common mistakes:
- Incorrect indentation (use spaces, not tabs)
- Missing space after the colon
- Unquoted special characters
-
Quote values with special characters:
--- title: "Getting Started: A Guide" description: "Learn about the 'features' here" ---
Build hangs or never completes
Symptoms: The build starts but never finishes, or takes an extremely long time.
Cause: Usually caused by very large files, circular references, or filesystem issues.
Solution:
- Check for very large markdown files (over 1MB)
- Look for files that should not be in
content/:find content -size +1M - Ensure no symbolic links create circular references
- Try building with fewer files to isolate the problem
Missing or Incorrect Pages
Page does not appear in navigation
Symptoms: A markdown file exists but does not show in the sidebar.
Causes and Solutions:
-
File not in content/ directory
- Verify the file is inside
content/, not at the project root
- Verify the file is inside
-
Hidden file
- Files starting with
.are ignored - Rename
.hidden.mdtohidden.md
- Files starting with
-
Not a .md file
- Only
.mdfiles are processed - Rename
.markdownor.txtto.md
- Only
-
Build cache issue
- Run
npm run clean && npm run build
- Run
Page shows wrong title
Symptoms: The navigation shows a different title than expected.
Cause: MarkStack uses the frontmatter title, falling back to the filename.
Solution:
-
Check your frontmatter:
--- title: Expected Title Here --- -
If no frontmatter, the title is derived from the filename:
my-page.mdbecomes “My Page”MyPage.mdbecomes “MyPage” (no transformation)
Page URL is wrong
Symptoms: The page is at /my-page/ but you expected /different-url/.
Cause: URLs are generated from titles, not filenames.
Solution:
- The URL comes from the
titlein frontmatter (slugified) - To change the URL, change the title:
This creates--- title: Different URL ---/different-url/
404 for a page that exists
Symptoms: Clicking a navigation link shows 404.
Causes and Solutions:
-
URL mismatch
- The link URL does not match the generated URL
- Check that the page title has not changed
-
Server configuration
- Your server may not handle clean URLs correctly
- For nginx, add:
try_files $uri $uri/ $uri/index.html =404;
-
Case sensitivity
- Linux servers are case-sensitive
/Getting-Started/is different from/getting-started/
Styling Issues
Styles not loading
Symptoms: Page appears unstyled, plain HTML.
Cause: CSS files are not being served or paths are wrong.
Solution:
-
Verify CSS files exist in
dist/css/:ls dist/css/ # Should show main.css, hljs-theme.css -
Check browser network tab for 404 errors on CSS
-
If self-hosting, ensure your server serves static files from
dist/ -
Verify the base path is correct (for subdirectory hosting)
Theme toggle does not work
Symptoms: Clicking the theme button does nothing.
Cause: JavaScript error or missing script.
Solution:
-
Check browser console for errors (press F12)
-
Verify
app.jsexists:ls dist/js/app.js -
Check for JavaScript errors in the console
-
Ensure no Content Security Policy blocks inline scripts
Code blocks not highlighted
Symptoms: Code appears but without syntax colors.
Cause: Missing language identifier or highlight.js issue.
Solution:
-
Specify the language in code blocks:
```javascript const x = 1; ``` -
Check that
hljs-theme.cssloads:ls dist/css/hljs-theme.css -
Verify the language is supported by highlight.js
Layout broken on mobile
Symptoms: Sidebar overlaps content, text too small.
Cause: CSS responsive rules not applied or viewport meta missing.
Solution:
-
Check that
templates/base.htmlincludes the viewport meta:<meta name="viewport" content="width=device-width, initial-scale=1.0"> -
Clear browser cache and reload
-
Check for custom CSS that might override responsive rules
Search Issues
Search returns no results
Symptoms: Searching shows “No results found” for terms that should match.
Causes and Solutions:
-
Search index not generated
ls dist/search-index.json # File should exist and not be empty -
Index not loading
- Check browser network tab for errors loading
search-index.json - Check browser console for JavaScript errors
- Check browser network tab for errors loading
-
Query too short
- Search requires at least 2 characters
- Try longer search terms
-
Content not indexed
- Rebuild:
npm run build - Check that pages have content (not empty)
- Rebuild:
Search is slow
Symptoms: Noticeable delay when typing in search.
Cause: Large search index or slow device.
Solution:
- Enable gzip compression on your server
- Consider limiting indexed content length in
build.js - The search debounces by 150ms; this is normal
Ctrl+K shortcut does not work
Symptoms: Pressing Ctrl+K does not focus the search box.
Cause: Browser or extension intercepting the shortcut.
Solution:
- Some browsers use Ctrl+K for address bar search
- Some extensions may capture this shortcut
- Click the search box instead, or press Tab to navigate to it
Deployment Issues
Site works locally but not deployed
Symptoms: Everything works with npx serve dist but fails on the hosting platform.
Causes and Solutions:
-
Build not running on host
- Verify build command is configured:
npm run build - Check platform build logs for errors
- Verify build command is configured:
-
Wrong output directory
- Ensure publish directory is set to
dist - Not
build,public, orout
- Ensure publish directory is set to
-
Missing dependencies
- Ensure
package-lock.jsonis committed - Use
npm ciinstead ofnpm installin CI
- Ensure
-
Node version mismatch
- Specify Node version in platform settings
- Use Node 18 or higher
Clean URLs not working
Symptoms: /about/ returns 404, but /about/index.html works.
Cause: Server not configured for clean URLs.
Solution:
For Netlify, add netlify.toml:
[[redirects]]
from = "/*"
to = "/404.html"
status = 404
For nginx:
location / {
try_files $uri $uri/ $uri/index.html =404;
}
For Apache .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html -f
RewriteRule ^(.*)$ $1/index.html [L]
Mixed content warnings
Symptoms: Browser shows security warnings, some resources do not load.
Cause: Loading HTTP resources on an HTTPS site.
Solution:
- Ensure all resource URLs in templates use
https://or protocol-relative// - Check
siteconfig.jsonuseshttps://forsiteUrl - Search generated HTML for
http://and update sources
Assets not found after deploy
Symptoms: CSS, JS, or images return 404 on production.
Cause: Path issues or incomplete deploy.
Solution:
- Verify all files in
dist/were uploaded - Check that paths use leading slash:
/css/main.css - If deployed to subdirectory, update base paths
Watch Mode Issues
Watch does not detect changes
Symptoms: Saving files does not trigger rebuild.
Causes and Solutions:
-
Saving to wrong location
- Verify you are editing files in
content/
- Verify you are editing files in
-
Editor not saving
- Check auto-save settings
- Manually save with Ctrl+S
-
Filesystem events not propagating
- Some network drives or Docker volumes have issues
- Try manual build:
npm run build
-
Too many files
- Operating systems limit watched files
- On Linux, increase limit:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
Watch uses high CPU
Symptoms: npm run watch consumes significant CPU.
Cause: Watching too many files or filesystem polling.
Solution:
- Ensure
node_modulesis not being watched - Close other applications that might compete for filesystem events
- Use
npm run buildfor one-off builds
TIP Most issues can be resolved by reinstalling dependencies (
npm install) and doing a clean build (npm run clean && npm run build). Try this first before investigating further.