coding-horror/basic-computer-games · warning · Error
Game "${folder}" is missing a javascript folder
Error message
Game "${folder}" is missing a javascript folder What it means
Thrown by findJSFilesInFolder() when a game directory lacks a child folder named 'javascript' (the JAVASCRIPT_FOLDER constant). The index builder expects every non-ignored game folder to contain a 'javascript/' subfolder holding the web port. This throw is caught by the try/catch in main() at build-index.js:134-139, so it surfaces as a console warning and the game is simply omitted from index.html rather than crashing the build.
Source
Thrown at 00_Utilities/build-index.js:93
</main>
</article>
</body>
`;
return `
<!DOCTYPE html>
<html lang="en">
${head}
${body}
</html>
`.trim().replace(/\s\s+/g, '');
}
function findJSFilesInFolder(folder) {
// filter folders that do not include a subfolder called "javascript"
const hasJavascript = fs.existsSync(`${folder}/${JAVASCRIPT_FOLDER}`);
if (!hasJavascript) {
throw new Error(`Game "${folder}" is missing a javascript folder`);
}
// get all files in the javascript folder
const files = fs.readdirSync(`${folder}/${JAVASCRIPT_FOLDER}`);
// filter files only allow .html files
const htmlFiles = files.filter(file => file.endsWith('.html'));
const mjsFiles = files.filter(file => file.endsWith('.mjs'));
const entries = [
...htmlFiles,
...mjsFiles
].filter(file => !IGNORE_FILES.includes(file));
if (entries.length == 0) {
throw new Error(`Game "${folder}" is missing a HTML or node.js file in the folder "${folder}/${JAVASCRIPT_FOLDER}"`);
}
return entries.map(file => path.join(folder, JAVASCRIPT_FOLDER, file));View on GitHub (pinned to 5301155192)
Solutions
- Confirm the game has a javascript port; if not, this is expected behavior and the warning can be ignored.
- If it should be skipped silently, add the folder prefix to IGNORE_FOLDERS_START_WITH at build-index.js:16.
- Create the missing 'javascript' subfolder with at least one .html or .mjs file.
Defensive patterns
Strategy: try-catch
Validate before calling
// Check before calling findJSFilesInFolder
const fs = require('fs');
function hasJSFolder(folder) {
return fs.existsSync(`${folder}/javascript`);
}
// skip folders without a javascript port instead of throwing Try / catch
// Already implemented in main() (build-index.js:134-139):
try { files = findJSFilesInFolder(folder); }
catch (error) { console.warn(`Game "${name}" is missing a javascript implementation: ${error.message}`); return null; } Prevention
- Treat the warning as informational: games without web ports are intentionally skipped.
- Maintain IGNORE_FOLDERS_START_WITH for folders that should never be scanned.
- Document that every numbered game is expected to ship a javascript/ subfolder.
When it happens
Trigger: Running `node ./00_Utilities/build-index.js` when a numbered game folder (e.g. '03_Animal') exists without a 'javascript' subfolder; main() calls findJSFilesInFolder for that folder and fs.existsSync returns false at line 91.
Common situations: A game has only a Java/Python/C# port and no JavaScript port yet; a folder was renamed/moved leaving an empty stub; a new game folder was added before its javascript/ implementation.
Related errors
AI-assisted analysis of coding-horror/basic-computer-games@5301155192 (2026-08-13).
Data as JSON: /api/errors/160d62a9b063597c.
Report an issue: GitHub.