XuanShu API

Install Node.js

Install Node.js 22 or newer on Windows, macOS, and Linux, then verify the node and npm commands. Claude Code, Codex, and Gemini CLI all depend on this environment.

1. Install Node.js (22 or newer) for your system

Pick your system and run the commands. Any one of the three Windows options is enough.

# 官网安装包(推荐)
# 打开 https://nodejs.org 下载 LTS 安装包,双击按提示安装
node --version
npm --version

2. Verify the installation

The environment is ready when both node --version and npm --version print a version. Node.js 22 or newer is required. If the command is not found, close and reopen the terminal, because PATH changes only apply to newly opened terminals.

4. Troubleshooting

SymptomCauseResolution
Command not foundPATH was not refreshed after installation, or the installer did not update it.Close every terminal and reopen one; on Windows, sign out and back in.
npm permission errorGlobal packages installed with sudo on Linux belong to root.Prefer nvm to manage Node.js so global installs never need sudo.
Version too oldDistribution repositories usually ship an older Node.js.Reinstall through NodeSource or Homebrew as shown above, and confirm the version is at least 22.