{
  "id": 4797626,
  "title": "Fixing npm Global Command Not Found on Windows",
  "url": "https://urgent.news/2026/09/01/fixing-npm-global-command-not-found-on-windows",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-01T05:43:14.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/devlog/fixing-npm-global-command-not-found-on-windows-50e1"
  },
  "original_language": "en",
  "account": "In the realm of Windows development environments, a perplexing issue arose: the \"command not found\" error when attempting to use a globally installed npm tool. This conundrum befuddled many a developer who had witnessed a triumphant npm install, only to be thwarted by an elusive error message.\n\nThe initial installation of a markdown processing tool through npm install -g markdown-it-cli proved successful, as evidenced by the terminal's confirmation of package addition. However, the moment the developer attempted to execute the command markdown-it-cli, they were met with an unwelcome response: \"markdown-it-cli is not recognized as an internal or external command, operable program or batch file.\"\n\nThis error signaled that Windows had perused all its catalogued folders but failed to locate an executable bearing that name. The developer's first instinct was to suspect a malfunction within the package itself. To quell this suspicion, they resorted to using npx, a command that executes packages sans the need for global installation. To their delight, npx successfully executed the tool, printing its version number and affirming its functionality.\n\nRealizing that the package functioned when executed via npx but not when called directly, the developer needed to understand why npm could not find its installation. A crucial command, npm root -g, revealed the directory where npm had deposited the executable files: C:\\Users\\user\\AppData\\Roaming\\npm. This directory pointed directly to the location of the tool.\n\nCurious about Windows's search paths, the developer queried echo %PATH%. This command displayed the directories Windows scrutinizes when seeking executables. The output listed typical system folders, Git, and Java - yet, crucially, it omitted the AppData\\Roaming\\npm directory. The missing path was the root cause of the predicament.\n\nThe PATH environment variable held the key to the solution. Windows, by default, does not append its global bin folder to the system PATH after a global npm install. Depending on the Node.js installation or update, this essential path entry could be inadvertently omitted. The developer's echo %PATH% confirmed the absence of the critical directory.\n\nTo rectify this, the developer ventured into Windows Environment Variables and added %AppData%\\npm to the User PATH variable. This addition directed Windows to the very location where npm root -g indicated the tools resided. After saving the change, the developer anticipated the fix would take effect immediately. However, they were in for a surprise. Despite the updated environment variable, running markdown-it-cli in the terminal still yielded the same error.\n\nThe critical oversight was that updating environment variables does not retroactively alter the environment of an already-running terminal session. The terminal's configuration had already been loaded, and thus, the PATH modification did not propagate to the current window. The solution lay in opening a brand new terminal window, thereby allowing the OS to apply the amended environment variables. Once a fresh terminal was initiated, running markdown-it -v succeeded flawlessly, validating the efficacy of the fix.\n\nThe takeaways from this experience are invaluable for developers navigating Windows development. When a globally installed CLI tool proves inoperable post-installation, the impulse to reinstall or attribute blame to the package should be curtailed. Instead, a systematic diagnostic approach should be adopted: ascertain the installation location via npm root -g, verify its presence in the %PATH% using echo %PATH%, and if absent, update the User PATH and inaugurate a new terminal session. By confirming the environment variable before discarding the tool as broken, developers can swiftly restore functionality and sidestep the frustration of unnecessary reinstalls. This narrative, rooted in authentic hands-on experience, underscores the importance of verifying paths before assuming a package's malfunction.",
  "summary": "Fixing npm Global Command Not Found on Windows I recently hit a wall while configuring my development environment on Windows. It's one of those subtle issues that can waste an afternoon if you don't know what to look for. Here's exactly how I diagnosed and fixed a 'command not found' error after a successful global install. The Problem I decided to add a markdown processing tool to my toolkit by…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}