🔧 Common Issues #
Solutions to frequently encountered problems when working with Admindek VanillaJS.
Installation Issues #
Node.js Version Compatibility #
Problem: Error messages during npm install about unsupported Node.js version.
error @rollup/rollup-linux-x64-gnu@4.9.4: The engine "node" is incompatible with this module.Solution:
-
Check your Node.js version:
node --version -
Use Node.js 20.19+ or 22.12+ (24 LTS recommended):
# Using Node Version Manager (recommended) nvm install 24 nvm use 24 # Or download from nodejs.org -
Clear cache and reinstall:
npm ci
Package Installation Failures #
Problem: npm install fails with permission errors or missing packages.
EACCES: permission denied, mkdir '/usr/local/lib/node_modules'Solutions:
Option 1 - Use npm prefix (Recommended):
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrcOption 2 - Fix permissions:
sudo chown -R $(whoami) ~/.npm
sudo chown -R $(whoami) /usr/local/lib/node_modulesOption 3 - Use Yarn instead:
npm install -g yarn
yarn install
yarn devBuild Errors #
Vite Configuration Issues #
Problem: Build fails with configuration errors.
[vite] Internal server error: Failed to resolve entry for package "admindek"Solutions:
-
Check vite.config.js syntax:
// Verify all imports exist import { defineConfig } from 'vite' import { vitePluginHtmlTemplates } from './plugins/vite-plugin-html-templates.js' // Check file paths are correct export default defineConfig({ // Valid configuration }) -
Verify plugin files exist:
ls -la plugins/ # Should show: vite-plugin-html-templates.js, vite-plugin-copy-assets.js -
Clear Vite cache:
rm -rf node_modules/.vite npm run build
SCSS Compilation Errors #
Problem: SCSS files fail to compile with import errors.
Error: Can't find stylesheet to import.
@import "bootstrap/scss/bootstrap";Solutions:
-
Check Bootstrap installation:
npm list bootstrap # Should show bootstrap@5.3.8 or similar -
Verify SCSS import paths:
// In style.scss - check these imports exist @import 'bootstrap/scss/bootstrap'; @import 'settings/theme-variables'; @import 'themes/general'; -
Check file structure:
ls src/assets/scss/settings/ # Should contain _theme-variables.scss, _bootstrap-variables.scss -
Clear SCSS cache:
rm -rf dist/ npm run build
Development Server Issues #
Port Already in Use #
Problem: Development server can't start because port is occupied.
Port 3000 is already in useSolutions:
-
Kill process using the port:
# Find process using port 3000 lsof -ti :3000 # Kill the process (replace PID with actual number) kill -9 PID # Or kill all Node processes (be careful!) killall node -
Use different port:
npm run preview -- --port 3001 -
Configure default port in vite.config.js:
export default defineConfig({ server: { port: 3001 } })
Raw @@include Directives on a Page #
Source HTML files require template processing. Start Vite with npm run dev and open http://localhost:3000/forms/form2_flu-uppy.html for the upload demo. Opening src/html/ files directly, or using a generic static server, cannot resolve includes. Use npm run build followed by npm run preview to view production output.
Vite redirects /src/html/... and /dist/... page URLs to their public routes. If the server returns a template-processing error, check its terminal log for the missing include or circular include path.
Changes Not Appearing #
npm run dev watches HTML templates and shared layouts and reloads the page. It also recopies shared scripts when they change. Compiled CSS, feature bundles such as Uppy, and copied vendor assets are served from dist/; run npm run build after changing those files, then refresh. The preview server always serves the last build and does not watch source files.
Styling Issues #
CSS Not Loading #
Problem: Styles don't appear on the page or look broken.
Symptoms:
- Unstyled HTML elements
- Bootstrap styles not applied
- Custom styles missing
Solutions:
-
Check CSS includes in HTML templates:
<!-- In head-css.html --> @@include('../layouts/head-css.html') <!-- Should generate links to CSS files --> <link rel="stylesheet" href="../assets/css/style.css"> -
Verify build output:
ls dist/assets/css/ # Should contain style.css and other CSS files -
Check console for CSS errors:
Open browser DevTools → Console → Look for 404 errors Failed to load resource: net::ERR_FILE_NOT_FOUND -
Clear browser cache:
# Hard refresh in browser Ctrl+Shift+R (Chrome/Firefox) Cmd+Shift+R (Safari)
Icons Not Displaying #
Problem: Phosphor or Tabler icons show as squares or don't appear.
Solutions:
-
Check icon font files:
ls dist/assets/fonts/ # Should contain phosphor/ and tabler/ folders -
Verify CSS includes:
<!-- Should be in head-css.html --> <link rel="stylesheet" href="../assets/fonts/phosphor/regular/style.css"> <link rel="stylesheet" href="../assets/fonts/tabler-icons.min.css"> -
Check icon syntax:
<!-- Phosphor icons (correct) --> <i class="ph-duotone ph-house"></i> <!-- Tabler icons (correct) --> <i class="ti ti-home"></i> <!-- Common mistakes --> <i class="ph ph-house"></i> <!-- Missing 'duotone' --> <i class="ph-house"></i> <!-- Missing 'ph-duotone' --> -
Test icon loading:
/* Add to test CSS loading */ .ph-duotone:before { content: "✓"; /* Should show checkmark if CSS loaded */ }
Theme Variables Not Working #
Problem: CSS custom properties or theme colors don't apply.
Solutions:
-
Check theme configuration:
// In vite.config.js const preset_theme = 'preset-1' // Should match desired theme const dark_layout = 'false' // Should match desired mode -
Verify CSS custom properties:
/* Check if these exist in browser DevTools */ :root { --bs-primary: #4f46e5; --pc-sidebar-bg: #1f2937; } -
Check body attributes:
<!-- Should be generated by @@bodySetup --> <body data-pc-preset="preset-1" data-pc-theme="light"> -
Browser compatibility:
// Check if CSS custom properties are supported if (window.CSS && CSS.supports('color', 'var(--fake)')) { console.log('CSS custom properties supported'); } else { console.log('CSS custom properties NOT supported'); }
JavaScript Issues #
Charts Not Rendering #
Problem: Charts don't display.
Symptoms:
- Empty chart containers
Chart is not definedorAdmindekChart is not definedin the consoleCanvas is already in use. Chart with ID '0' must be destroyed before the canvas with ID '' can be reused.- A chart that is 0px tall, or one that only appears after resizing the window
Solutions:
-
Check that Chart.js and the theme preset loaded:
// In browser console console.log(typeof Chart); // "function" - chart.umd.min.js loaded console.log(typeof AdmindekChart); // "object" - chart-theme.js loadedIf either is
"undefined", look in the Network tab for a 404 onassets/js/plugins/chart.umd.min.jsorassets/js/chart-theme.js. The vendor file is copied fromnode_modulesby the build, so runnpm installand rebuild if it is missing fromdist/assets/js/plugins/. -
Check script loading order:
<!-- Chart.js first, then any Chart.js plugins, then the theme preset, then the page script --> <script src="../assets/js/plugins/chart.umd.min.js"></script> <script src="../assets/js/chart-theme.js"></script> <script src="../assets/js/widgets/bar-chart.js"></script>chart-theme.jsdoes nothing ifChartis not defined yet, soAdmindekChartwill be missing when the order is wrong. Pages in the root folder (such asindex.html) useassets/js/...without the../. -
Verify the chart container exists:
const container = document.querySelector('#chart-id'); console.log(container); // Should not be nullAdmindekChart.create()returnsnullwhen the target is missing, so a typo in the selector fails silently. -
Make sure the container has a height:
// Give the chart a fixed height (sets it on the container) AdmindekChart.create('#chart-id', config, { height: 300 });If you set
maintainAspectRatio: falseyourself, the container needs a height from CSS or from theheightoption; otherwise the canvas is 0px tall. Charts inside Bootstrap tabs, modals, collapses and offcanvas panels are resized automatically when those are shown. -
"Canvas is already in use": This happens when
new Chart()is called twice on the same<canvas>(for example when re-rendering after new data arrives). Create charts withAdmindekChart.create(), which destroys the previous chart in that container first, or update the existing instance instead:const chart = AdmindekChart.create('#chart-id', config, { height: 300 }); // Later: update in place instead of creating a new chart chart.data.datasets[0].data = newData; chart.update(); // Or remove it completely chart.destroy(); -
Debug chart initialization:
document.addEventListener('DOMContentLoaded', function () { const chartElement = document.querySelector('#chart-id'); console.log('Chart element:', chartElement); if (chartElement && typeof AdmindekChart !== 'undefined') { // Chart initialization code } else { console.error('Chart requirements not met'); } });
Form Validation Not Working #
Problem: Form validation doesn't trigger or show errors.
Solutions:
-
Check Bootstrap validation classes:
<!-- Correct validation markup --> <form class="needs-validation" novalidate> <div class="mb-3"> <input type="email" class="form-control" required> <div class="invalid-feedback"> Please enter a valid email. </div> </div> </form> -
Verify JavaScript validation:
// Bootstrap validation initialization (function() { 'use strict'; var forms = document.querySelectorAll('.needs-validation'); Array.prototype.slice.call(forms).forEach(function(form) { form.addEventListener('submit', function(event) { if (!form.checkValidity()) { event.preventDefault(); event.stopPropagation(); } form.classList.add('was-validated'); }, false); }); })(); -
Check form submission:
// Debug form validation document.querySelectorAll('form').forEach(form => { form.addEventListener('submit', function(e) { console.log('Form submitted:', form); console.log('Valid:', form.checkValidity()); }); });
Navigation Issues #
Sidebar Menu Not Working #
Problem: Sidebar navigation doesn't expand/collapse or links don't work.
Solutions:
-
Check Bootstrap JavaScript:
<!-- Ensure Bootstrap JS is loaded --> <script src="../assets/js/plugins/bootstrap.min.js"></script> -
Verify menu HTML structure:
<!-- Correct dropdown structure --> <li class="pc-item pc-hasmenu"> <a href="#!" class="pc-link"> <span class="pc-mtext">Dashboard</span> <span class="pc-arrow"><i data-feather="chevron-right"></i></span> </a> <ul class="pc-submenu"> <li class="pc-item"> <a class="pc-link" href="../dashboard/analytics.html">Analytics</a> </li> </ul> </li> -
Check active menu highlighting:
// Debug active menu detection const currentPath = window.location.pathname; console.log('Current path:', currentPath); document.querySelectorAll('.pc-link').forEach(link => { if (link.getAttribute('href').includes(currentPath)) { console.log('Should be active:', link); } });
Breadcrumb Issues #
Problem: Breadcrumbs show incorrect paths or don't update.
Solutions:
-
Check breadcrumb template usage:
<!-- Correct breadcrumb include --> @@include('../layouts/breadcrumb.html', { 'breadcrumb-item': 'Dashboard', 'breadcrumb-item-active': 'Analytics' }) -
Verify breadcrumb.html template:
<!-- In layouts/breadcrumb.html --> <div class="page-header"> <div class="page-block"> <div class="row align-items-center"> <div class="col-md-12"> <div class="page-header-title"> <h2 class="mb-0">@@breadcrumb-item-active</h2> </div> <ul class="breadcrumb"> <li class="breadcrumb-item"> <a href="../dashboard/index.html">@@breadcrumb-item</a> </li> <li class="breadcrumb-item active">@@breadcrumb-item-active</li> </ul> </div> </div> </div> </div>
Performance Issues #
Slow Page Loading #
Problem: Pages take too long to load.
Diagnosis Steps:
-
Check Network tab in DevTools:
- Look for large file sizes (>1MB)
- Check for failed requests (404s)
- Identify slow-loading resources
-
Common causes and solutions:
Large Bundle Sizes:
# Analyze bundle size
npm run build -- --analyze
# Check dist folder size
du -sh dist/Unused Dependencies:
# Check for unused packages
npm audit
npm outdated
# Remove unused dependencies
npm uninstall unused-packageUnoptimized Images:
# Check image sizes
find dist/assets/images -name "*.jpg" -o -name "*.png" | xargs ls -lh
# Use optimized formats (WebP, modern formats)
# Implement lazy loading for images below fold- Performance optimization:
// Lazy load images
document.addEventListener('DOMContentLoaded', function() {
const images = document.querySelectorAll('img[data-src]');
const imageObserver = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const img = entry.target;
img.src = img.dataset.src;
img.removeAttribute('data-src');
imageObserver.unobserve(img);
}
});
});
images.forEach(img => imageObserver.observe(img));
});Browser Compatibility Issues #
Internet Explorer Support #
Problem: Template doesn't work in older browsers.
Solution: Admindek targets modern browsers. For IE support:
// Add polyfills for older browsers
if (!window.fetch) {
// Add fetch polyfill
document.head.appendChild(script);
}
// Check for CSS custom property support
if (!CSS.supports('color', 'var(--fake)')) {
// Fallback for older browsers
document.documentElement.className += ' no-css-vars';
}Mobile Browser Issues #
Problem: Issues on iOS Safari or Android Chrome.
Solutions:
-
Check viewport meta tag:
<meta name="viewport" content="width=device-width, initial-scale=1"> -
Test responsive behavior:
/* Add iOS-specific fixes */ @supports (-webkit-touch-callout: none) { .ios-fix { /* iOS-specific styles */ } } -
Check touch interactions:
// Ensure touch events work element.addEventListener('touchstart', handleTouch, { passive: true });
Getting Help #
Diagnostic Information to Collect #
When reporting issues, include:
# System information
echo "Node.js: $(node --version)"
echo "NPM: $(npm --version)"
echo "OS: $(uname -a)"
# Project information
npm list --depth=0
git status
git log --oneline -3
# Error messages (copy full error text)
npm run build 2>&1 | tee build-error.logSupport Channels #
- Email: dashboardpack@gmail.com
- Include: Error messages, system info, steps to reproduce
- Response Time: Usually within 24-48 hours
Prevention Tips #
- Keep dependencies updated: Regular
npm update - Use version control: Commit working states frequently
- Test across browsers: Don't develop in just one browser
- Monitor console: Check for warnings/errors regularly
- Backup before changes: Create backups before major modifications
Most issues can be resolved with these solutions. If you encounter a persistent problem not covered here, don't hesitate to contact support with detailed information about your environment and the specific issue.