{"record":{"id":"7bfa4a73504cf87f","repo":"parcel-bundler/parcel","slug":"the-elm-json-file-is-missing","errorCode":null,"errorMessage":"The 'elm.json' file is missing.","messagePattern":"The 'elm\\.json' file is missing\\.","errorType":"exception","errorClass":"ThrowableDiagnostic","httpStatus":null,"severity":"error","filePath":"packages/transformers/elm/src/loadConfig.js","lineNumber":13,"sourceCode":"// @flow strict-local\n\nimport type {Config} from '@parcel/types';\nimport path from 'path';\nimport ThrowableDiagnostic from '@parcel/diagnostic';\nimport commandExists from 'command-exists';\nimport nullthrows from 'nullthrows';\n\nasync function load({config}: {|config: Config|}): Promise<null> {\n  const elmConfig = await config.getConfig(['elm.json']);\n  if (!elmConfig) {\n    elmBinaryPath(); // Check if elm is even installed\n    throw new ThrowableDiagnostic({\n      diagnostic: {\n        origin: '@parcel/elm-transformer',\n        message: \"The 'elm.json' file is missing.\",\n        hints: [\n          \"Initialize your elm project by running 'elm init'\",\n          \"If you installed elm as project dependency then run 'yarn elm init' or 'npx elm init'\",\n        ],\n      },\n    });\n  }\n\n  return null;\n}\n\nfunction elmBinaryPath(): ?string {\n  let elmBinary = resolveLocalElmBinary();\n\n  if (elmBinary == null && !commandExists.sync('elm')) {","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/transformers/elm/src/loadConfig.js#L1-L31","documentation":"Thrown by @parcel/transformer-elm's config loader when config.getConfig(['elm.json']) returns nothing. Before throwing, it calls elmBinaryPath() so a missing-binary hint can also surface. The diagnostic is a ThrowableDiagnostic with hints pointing to `elm init`.","triggerScenarios":"An Elm source file (a .elm asset) is being transformed but the project root has no elm.json. Parcel only triggers the Elm transformer when an Elm file is in the dependency graph.","commonSituations":"Adding an .elm file without running `elm init`; cloning an Elm project whose elm.json is gitignored; building from the wrong directory so Parcel's projectRoot does not contain elm.json.","solutions":["Run `elm init` (or `npx elm init` / `yarn elm init`) in the same directory as elm.json should live (Parcel's projectRoot).","If elm.json exists elsewhere, run Parcel from the directory containing it or restructure so it sits at the project root.","Make sure elm.json is committed (not gitignored) in shared projects.","If Elm is not actually used, remove the stray .elm file or exclude it."],"exampleFix":"# before: project root has src/Main.elm but no elm.json\nelm init   # creates elm.json with src/ in source-directories","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst path = require('path');\nfunction assertElmJson(projectRoot) {\n  if (!fs.existsSync(path.join(projectRoot, 'elm.json'))) {\n    throw new Error('elm.json missing — run `elm init` before building');\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Commit elm.json to git.","Run `elm init` as a postinstall step in Elm-only repos."],"tags":["elm","config","transformer","missing-config"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}