{"record":{"id":"653cfb3a0f1237c0","repo":"parcel-bundler/parcel","slug":"neither-npm-nor-yarn-found-on-system","errorCode":null,"errorMessage":"Neither npm nor yarn found on system","messagePattern":"Neither npm nor yarn found on system","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/utils/create-react-app/src/cli.js","lineNumber":140,"sourceCode":"\nlet usesYarn;\nasync function installPackages(\n  packageExpressions: Array<string>,\n  opts: {|\n    cwd: string,\n    isDevDependency?: boolean,\n  |},\n): Promise<void> {\n  log(\n    emoji.progress,\n    chalk`{dim Installing}`,\n    chalk.bold(...packageExpressions),\n  );\n\n  if (usesYarn == null) {\n    usesYarn = await commandExists('yarn');\n    if (!usesYarn && !(await commandExists('npm'))) {\n      throw new Error('Neither npm nor yarn found on system');\n    }\n  }\n\n  if (usesYarn) {\n    return promiseFromProcess(\n      spawn(\n        'yarn',\n        [\n          'add',\n          opts.isDevDependency ? '--dev' : null,\n          ...packageExpressions,\n        ].filter(Boolean),\n        {cwd: opts.cwd},\n      ),\n    );\n  }\n\n  return promiseFromProcess(","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/utils/create-react-app/src/cli.js#L122-L158","documentation":"Thrown by @parcel/create-react-app's install helper when usesYarn is null and neither yarn nor npm can be found on PATH (commandExists returns false for both). The helper needs at least one package manager to spawn the install process.","triggerScenarios":"commandExists('yarn') resolves false AND commandExists('npm') resolves false, before any package can be installed.","commonSituations":"Running the CLI in a minimal Docker container, a CI image without Node tooling, or a system where Node was installed without npm. Also when PATH is misconfigured so neither binary is discoverable.","solutions":["Install Node.js (which ships npm): use nvm, fnm, or the official installer.","Optionally install Yarn: `npm install -g yarn` or use Corepack.","Verify with `which npm` / `which yarn` that the binary is on PATH.","If in a container, extend the image to include node/npm."],"exampleFix":"// before\n$ docker run --rm minimal-image create-react-app app  // no npm/yarn\n// after\n$ apk add --no-cache nodejs npm   # then re-run create-react-app","handlingStrategy":"validation","validationCode":"const commandExists = require('command-exists');\nasync function ensurePackageManager() {\n  let usesYarn = false;\n  try { await commandExists('yarn'); usesYarn = true; } catch {}\n  if (!usesYarn) { try { await commandExists('npm'); } catch { throw new Error('Install Node.js (npm) or Yarn first.'); } }\n  return usesYarn;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install Node.js (bundles npm) before running the CLI.","Verify `which npm && which yarn` succeeds in your environment.","For containers, extend the base image with nodejs + npm."],"tags":["create-react-app","cli","package-manager","environment"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}