| name | nodejs-version-setup |
| description | Ensures Node.js commands run with the project-required Node version before install, build, test, or scripts. |
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-version
package.json -> engines.node
- Detect an installed version manager in this order:
- Select the required version with the first available manager:
nvm: nvm install and nvm use
fnm: fnm install and fnm use
asdf: asdf install nodejs <version> and asdf local nodejs <version>
volta: volta install node@<version>
- If no version file exists but
engines.node exists, 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 -v satisfies 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 -v
npm -v (or pnpm -v / yarn -v depending on the project)
which node to confirm the active binary path
- In task output, report which source defined the version (for example
.nvmrc), which manager was used, and the final node -v.
- Do not run dependency install, build, test, or CLI scripts until version selection and verification are complete.