Troubleshooting your Command Code

Common issues and solutions for Command Code. If you can't find what you're looking for here, check the FAQs or Error Codes pages.

Problem: Running cmd prints:

Command Code needs Node.js 22 or newer — you're on v20.20.2.

On versions of Command Code before this check existed, the same cause showed up as a crash instead:

SyntaxError: The requested module 'fs/promises' does not provide an export named 'glob' at ModuleJob._instantiate (node:internal/modules/esm/module_job:213:21)

Command Code requires Node.js 22 or newer (the current LTS). Node 22 is where APIs the CLI depends on landed, so on Node 20 and below it cannot start.

Solution:

  1. Check what you're running:

    node -v
  2. If it's below v22, upgrade using one of the options in Upgrading Node.js below.

  3. Reinstall Command Code so its cmd binary is linked against the new Node:

    npm i -g command-code

    This step matters. Global binaries are linked to the Node version that installed them, so skipping it can leave cmd pointing at your old Node and failing with the same message.

  4. Confirm:

    node -v # v22.x or newer cmd

Pick whichever matches your setup. If you don't already use a version manager, n is the quickest way to get onto the LTS.

n (simplest, macOS/Linux):

npm install -g n && n lts

If your global npm prefix is a root-owned directory, both commands need sudo.

nvm (macOS/Linux):

nvm install --lts && nvm use --lts nvm alias default lts/* # make it the default in new shells

fnm (fast, cross-platform):

fnm install --lts && fnm use lts-latest fnm default lts-latest

Volta (cross-platform, pins per project):

volta install node@lts

asdf (multi-language version manager):

asdf install nodejs latest:22 asdf set -u nodejs latest:22 # asdf 0.15 and older: asdf global nodejs latest:22

Homebrew (macOS):

brew upgrade node # or, if Node was never installed via brew: brew install node

Windows (winget, Chocolatey, or a version manager):

winget install OpenJS.NodeJS.LTS # or choco upgrade nodejs-lts # or, for switching between versions: nvm install lts nvm use lts

nvm on Windows means nvm-windows, which is a different tool from the macOS/Linux nvm; its commands are similar but not identical. fnm also works well on Windows. See the Windows guide for the rest of the Windows setup.

Linux via NodeSource (system-wide, no version manager):

curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - sudo apt-get install -y nodejs

Official installer / archives: download the LTS build for your platform from nodejs.org.

After upgrading by any route, reinstall Command Code (npm i -g command-code) so cmd relinks to the new Node.

Note

If node -v still reports the old version in a new terminal, your shell is finding an older Node earlier in PATH. Run which -a node (where node on Windows) to see every Node on your PATH and remove or reorder the stale one.

Problem: Running cmd returns "command not found"

Solution:

  1. Verify the install succeeded:

    > npm list -g command-code ~/.nvm/versions/node/v<node-version>/lib └── command-code@<command-code-version>
  2. Ensure your global node_modules/.bin is in your PATH:

    npm config get prefix

    The binary directory is <prefix>/bin. Add that to your PATH if it's not already there.

  3. Restart your terminal or source your shell profile: