{"record":{"id":"db042c66b73f193d","repo":"coding-horror/basic-computer-games","slug":"game-folder-is-missing-a-html-or-node-js-file","errorCode":null,"errorMessage":"Game \"${folder}\" is missing a HTML or node.js file in the folder \"${folder}/${JAVASCRIPT_FOLDER}\"","messagePattern":"Game \"(.+?)\" is missing a HTML or node\\.js file in the folder \"(.+?)/(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"00_Utilities/build-index.js","lineNumber":108,"sourceCode":"\t// filter folders that do not include a subfolder called \"javascript\"\n\tconst hasJavascript = fs.existsSync(`${folder}/${JAVASCRIPT_FOLDER}`);\n\tif (!hasJavascript) {\n\t\tthrow new Error(`Game \"${folder}\" is missing a javascript folder`);\n\t}\n\n\t// get all files in the javascript folder\n\tconst files = fs.readdirSync(`${folder}/${JAVASCRIPT_FOLDER}`);\n\n\t// filter files only allow .html files\n\tconst htmlFiles = files.filter(file => file.endsWith('.html'));\n\tconst mjsFiles = files.filter(file => file.endsWith('.mjs'));\n\tconst entries = [\n\t\t...htmlFiles,\n\t\t...mjsFiles\n\t].filter(file => !IGNORE_FILES.includes(file));\n\n\tif (entries.length == 0) {\n\t\tthrow new Error(`Game \"${folder}\" is missing a HTML or node.js file in the folder \"${folder}/${JAVASCRIPT_FOLDER}\"`);\n\t}\n\n\treturn entries.map(file => path.join(folder, JAVASCRIPT_FOLDER, file));\n}\n\nfunction main() {\n\t// Get the list of all folders in the current director\n\tlet folders = fs.readdirSync(process.cwd());\n\n\t// filter files only allow folders\n\tfolders = folders.filter(folder => fs.statSync(folder).isDirectory());\n\n\t// filter out the folders that start with a dot or 00_\n\tfolders = folders.filter(folder => {\n\t\treturn !IGNORE_FOLDERS_START_WITH.some(ignore => folder.startsWith(ignore));\n\t});\n\n\t// sort the folders alphabetically (by number)","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/coding-horror/basic-computer-games/blob/5301155192d91d74d337899cecc59dbda59c4c17/00_Utilities/build-index.js#L90-L126","documentation":"Thrown by findJSFilesInFolder() when a game folder DOES have a 'javascript' subfolder, but after filtering for .html and .mjs files and removing IGNORE_FILES entries, zero usable files remain. Like error 1 it is caught by main()'s try/catch (build-index.js:134-139) and reported as a warning, with the game dropped from the generated index.","triggerScenarios":"A game's javascript/ folder contains only non-.html/.mjs files (e.g. only .js, .css, .json), or contains only files listed in IGNORE_FILES ('cli.mjs','superstartrek.mjs'), or is completely empty.","commonSituations":"The folder holds only helper modules (.js) with no runnable .html entry point; every .mjs in the folder happens to be in IGNORE_FILES; build artifacts were committed but the real .html was not.","solutions":["Add a runnable .html or .mjs entry-point file to the game's javascript/ folder.","If the only files present are wrongly blacklisted, remove the relevant name from IGNORE_FILES at build-index.js:17-20.","If the game genuinely has no web port, ignore the warning or add the folder to IGNORE_FOLDERS_START_WITH."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-check a game's javascript folder for usable files\nfunction hasUsableFiles(folder) {\n  const fs = require('fs');\n  const files = fs.existsSync(`${folder}/javascript`) ? fs.readdirSync(`${folder}/javascript`) : [];\n  return files.some(f => (f.endsWith('.html') || f.endsWith('.mjs')) && !IGNORE_FILES.includes(f));\n}","typeGuard":null,"tryCatchPattern":"// Same catch as error 1 (build-index.js:134-139) handles this throw:\ntry { files = findJSFilesInFolder(folder); }\ncatch (error) { console.warn(`...`); return null; }","preventionTips":["Ensure each game's javascript/ folder has at least one runnable .html or non-ignored .mjs entry point.","Review IGNORE_FILES before relying on a .mjs that may be blacklisted.","Add a CI step running build-index.js and failing only on unexpected warnings."],"tags":["nodejs","build-script","empty-folder","filesystem"],"backgroundTag":null,"analyzedSha":"5301155192d91d74d337899cecc59dbda59c4c17","analyzedAt":"2026-08-13T19:29:00.979Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}