{
 "kind": "tool",
 "slug": "cross-spawn",
 "path": "tools/cross-spawn/",
 "name": "cross-spawn",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Dev workflow and config",
   "tools/dev-workflow/"
  ]
 ],
 "lead": "Start other programs the same way on Windows.",
 "chips": [
  {
   "label": "Dev workflow and config",
   "path": "tools/dev-workflow/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install cross-spawn"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/moxystudio/node-cross-spawn"
  },
  {
   "label": "Website",
   "href": "https://github.com/moxystudio/node-cross-spawn"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software",
   "note": "MIT allows use in paid and closed-source products.",
   "src": "https://github.com/moxystudio/node-cross-spawn/blob/master/LICENSE"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 1, 2026",
   "note": "",
   "src": "https://github.com/moxystudio/node-cross-spawn"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "8 projects",
   "status": "info",
   "sub": "#117 of 299 in its category",
   "note": "Dependency in 8 public GitHub projects set up for AI coding agents that we scanned (0.1%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Install only",
   "status": "info",
   "sub": null,
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 11, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What cross-spawn does",
   "parts": [
    {
     "t": "prose",
     "text": "cross-spawn is a small free library for Node.js programs that start other programs, like npm, git or a build script. On Mac and Linux it changes nothing. On Windows it finds the right file, adds the escaping that Windows needs and runs scripts that start with a \"#!\" line, so the same code works everywhere."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Run npm scripts from your tool",
       "text": "Your setup or build script calls \"npm install\" or \"npm run build\". On Windows npm is a .cmd file that a plain start call cannot find; cross-spawn finds and runs it.",
       "idea": false
      },
      {
       "title": "Pass awkward arguments safely",
       "text": "A commit message with an ampersand, or a lint rule with quotes and brackets, reaches the other program exactly as you wrote it, also on Windows.",
       "idea": false
      },
      {
       "title": "Start scripts that use a \"#!\" line",
       "text": "Your project has helper scripts that begin with \"#!/usr/bin/env node\". Windows does not read that line; cross-spawn does and starts the script with node.",
       "idea": false
      },
      {
       "title": "A command line tool for every system",
       "text": "You publish a small developer tool that starts git, npm or a compiler. It behaves the same for users on Windows as on a Mac.",
       "idea": false
      },
      {
       "title": "Agent tools that run commands",
       "text": "Your AI agent's \"run a command\" tool gets a program name and its arguments from the model. It starts them without a shell, so the tool also works on Windows.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "cross-spawn popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "59",
       "of": "/ 100",
       "l": "Gid Score, #1135 overall"
      },
      {
       "n": "362M",
       "l": "downloads a week, npm"
      },
      {
       "n": "1,174",
       "l": "GitHub stars"
      },
      {
       "n": "8",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How cross-spawn is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "cross-spawn is a dependency in 8 of the 6,258 public GitHub projects set up for AI coding agents that we scanned, too few to describe it from them alone. Our scan also samples projects by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750); counting those, it appears in 46 projects, and what it is used with below comes from all of them.",
      "The most used alternative in our scan is concurrently (484 projects).",
      "Projects that use it most often also use Model Context Protocol SDK (JavaScript) (41.3%), ws (39.1%), Axios (34.8%)."
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 41.3% of its projects",
       "v": "Model Context Protocol SDK (JavaScript)",
       "path": "tools/modelcontextprotocol/"
      },
      {
       "l": "In 39.1% of its projects",
       "v": "ws",
       "path": "tools/ws/"
      },
      {
       "l": "In 34.8% of its projects",
       "v": "Axios",
       "path": "tools/axios/"
      },
      {
       "l": "In 34.8% of its projects",
       "v": "chalk",
       "path": "tools/chalk/"
      },
      {
       "l": "In 32.6% of its projects",
       "v": "Anthropic SDK",
       "path": "tools/anthropic-ai/"
      },
      {
       "l": "In 30.4% of its projects",
       "v": "yaml",
       "path": "tools/yaml/"
      },
      {
       "l": "In 34.8% of its projects",
       "v": "Husky",
       "path": "tools/husky/"
      },
      {
       "l": "In 28.3% of its projects",
       "v": "Express",
       "path": "tools/express/"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "usage",
   "h2": "More about cross-spawn",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "More in Dev workflow and config",
       "path": "tools/dev-workflow/",
       "items": [
        {
         "text": "dotenv",
         "path": "tools/dotenv/"
        },
        {
         "text": "Husky",
         "path": "tools/husky/"
        },
        {
         "text": "python-dotenv",
         "path": "tools/python-dotenv/"
        },
        {
         "text": "lint-staged",
         "path": "tools/lint-staged/"
        },
        {
         "text": "Rich",
         "path": "tools/rich/"
        },
        {
         "text": "Pydantic Settings",
         "path": "tools/pydantic-settings/"
        },
        {
         "text": "cross-env",
         "path": "tools/cross-env/"
        },
        {
         "text": "chalk",
         "path": "tools/chalk/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "cross-spawn",
       "me": true,
       "facts": [
        "MIT",
        "Gid 59",
        "362M/wk"
       ]
      },
      {
       "name": "execa",
       "why": "Pick execa when you want promises, captured output and nicer errors on top of starting programs, with its own Windows handling.",
       "path": "tools/execa/",
       "facts": []
      },
      {
       "name": "zx",
       "why": "Pick zx when you are writing a whole shell-style script in JavaScript rather than starting one program from your code.",
       "path": "tools/zx/",
       "facts": []
      },
      {
       "name": "ShellJS",
       "why": "Pick ShellJS when you need Unix commands like cp, rm or grep themselves to work on Windows, not other programs started.",
       "path": "tools/shelljs/",
       "facts": []
      },
      {
       "name": "concurrently",
       "why": "Run multiple npm scripts concurrently for efficient development workflows.",
       "path": "tools/concurrently/",
       "facts": [
        "MIT",
        "Gid 76",
        "30.1M/wk"
       ]
      }
     ],
     "more": "Compare cross-spawn with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Use the npm package cross-spawn (pin cross-spawn@7.0.6) instead of child_process.spawn to start npm and git from this Node.js script; pass the arguments as an array, do not set shell: true, and check result.error and result.status."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Add cross-spawn to your Node.js project (Node.js 8 or newer).",
       "code": "npm install cross-spawn",
       "src": "https://github.com/moxystudio/node-cross-spawn/blob/master/README.md"
      },
      {
       "text": "Use it exactly like Node's own spawn and spawnSync; only the import changes.",
       "code": "const spawn = require('cross-spawn');\n\n// Spawn NPM asynchronously\nconst child = spawn('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' });\n\n// Spawn NPM synchronously\nconst result = spawn.sync('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' });\n",
       "src": "https://github.com/moxystudio/node-cross-spawn/blob/master/README.md"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "\"cross-spawn\": \"7.0.3\" (or any 7.x below 7.0.5, or 6.x below 6.0.6) left in package.json or the lockfile",
       "fix": "Pin cross-spawn 7.0.6 (or 6.0.6 for Node.js 7 and older) and refresh the lockfile",
       "why": "Older versions have a known slow-down bug (CVE-2024-21538) triggered by crafted long text."
      },
      {
       "dont": "spawn('npm run build', { shell: true }) or one string built from user input",
       "fix": "spawn('npm', ['run', 'build']) with the arguments as an array and no shell option",
       "why": "With shell on, cross-spawn does no escaping, and hand-escaping user input is error prone."
      },
      {
       "dont": "child_process.execFile('npm', ...) or spawn('npm', ...) from node:child_process on Windows",
       "fix": "spawn('npm', [...]) from cross-spawn",
       "why": "On Windows npm is a .cmd file, and Node's own docs say .cmd and .bat files cannot be launched with execFile."
      },
      {
       "dont": "import spawn from 'cross-spawn'; await spawn(...)  // expecting a promise",
       "fix": "Listen for 'close' and 'error' on the returned child, or use spawn.sync; for promises use execa",
       "why": "It is a drop-in for Node's spawn, so it returns a child process object, not a promise."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Does it change anything on Mac or Linux?",
       "a": "No. The extra work only happens on Windows; elsewhere your call goes to Node's spawn unchanged, as our run shows.",
       "evidence": {
        "url": "https://github.com/moxystudio/node-cross-spawn/blob/master/README.md",
        "quote": "Node has issues when using spawn on Windows:"
       }
      },
      {
       "q": "Why not just use shell true in Node's spawn?",
       "a": "Then you have to escape the command and arguments yourself, which is easy to get wrong, especially with user input.",
       "evidence": {
        "url": "https://github.com/moxystudio/node-cross-spawn/blob/master/README.md",
        "quote": "You must manually escape the command and arguments which is very error prone, specially when passing user input"
       }
      },
      {
       "q": "Which version do I need for an old Node.js?",
       "a": "Version 7 needs Node.js 8 or newer; for Node.js 7 and older the README points to version 6.",
       "evidence": {
        "url": "https://github.com/moxystudio/node-cross-spawn/blob/master/README.md",
        "quote": "Node.js version 7 and under:"
       }
      },
      {
       "q": "Can I use it in a commercial product?",
       "a": "Yes. It is MIT-licensed; keep the license notice with copies of its files.",
       "evidence": {
        "url": "https://github.com/moxystudio/node-cross-spawn/blob/master/README.md",
        "quote": "Released under the MIT License."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm cross-spawn"
  ],
  [
   "Category",
   "Dev workflow and config"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Gid Score",
   "58.6"
  ],
  [
   "Rank in category",
   "#117 of 299"
  ],
  [
   "GitHub",
   "moxystudio/node-cross-spawn"
  ],
  [
   "Last change",
   "Nov 1, 2026"
  ]
 ],
 "good": [
  "Use version 7.0.5 or newer (or 6.0.6 on the old line): earlier versions can be slowed to a halt by a long, crafted text.",
  "If you turn on the shell option, cross-spawn steps aside and does no escaping and no \"#!\" handling.",
  "Its \"#!\" support is limited to the simple \"/usr/bin/env program\" form, with no extra words after the program name."
 ],
 "checked_line": "Read by AgentGid from 9 official pages, card checked Nov 11, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/moxystudio.png"
}