nodejs-version-setup
Set and verify the correct Node.js runtime for this repository before running any Node.js command.
When to use
Use this skill whenever the task runs Node.js tooling, including npm, pnpm, yarn, npx, build scripts, tests, linters, or local CLIs.
Instructions
- Detect the required Node.js version in this order:
.nvmrc.node-versionpackage.json->engines.node
- Detect an installed version manager in this order:
nvmfnmasdfvolta
- Select the required version with the first available manager:
nvm:nvm installandnvm usefnm:fnm installandfnm useasdf:asdf install nodejs <version>andasdf local nodejs <version>volta:volta install node@<version>
- If no version file exists but
engines.nodeexists, resolve a concrete version inside that range and install/use it with the detected manager. - If no manager is available, check whether the current
node -vsatisfies the required version. If it does not, stop and ask the user to confirm whether to install a version manager or proceed manually. - Verify runtime before executing project commands:
node -vnpm -v(orpnpm -v/yarn -vdepending on the project)which nodeto confirm the active binary path
- In task output, report which source defined the version (for example
.nvmrc), which manager was used, and the finalnode -v. - Do not run dependency install, build, test, or CLI scripts until version selection and verification are complete.