npm not being a build tool in itself (only handles dependencies and executes scripts), you may refer to unspecified build command and executable?

Our build pipeline is basically npm i followed by some custom node script.js then npm test, npm prune, npm audit etc.

  • npm test just executes your scripts.test command; if the underlying executable requires Node, it will use the binary specified in the PATH
  • npm prune and npm audit work on your dependencies and their version, irrespective of Node
  • node script.js obviously uses the corresponding Node version (here what is specified in the PATH)
  • npm install will install the package dependencies (and development dependencies), according to their specified versions; it is up to you to ensure compatibility of your dependencies version with your targeted Node version; if they specify some Node engines constraint, and the latter is not met by the version in PATH, it will only produce a warning (unless you set the engine-strict flag):

Unless the user has set the engine-strict config flag, this field is advisory only and will only produce warnings when your package is installed as a dependency.


That being said, with nvm you can at least use a specific node and npm version, for a single command, irrespective of the current system, terminal session or default node/npm version of your build server, using nvm exec <nodeVersion> npm <command>:

you can run any arbitrary command in a subshell with the desired version of node

(Or its associated npm version)

For example:

nvm exec 18 npm install # Will use the appropriate npm version for Node v18, and will see that Node v18 if needing Node

It actually launches a subshell and nvm use <version> under the hood, and executes your command there. Therefore these Node and npm versions may differ from the rest of the machine shells.

For example if a dependency has a prepare script that requires Node, it will get the version provided by nvm exec <version> after being npm install'ed.

Answer from ghybs on Stack Overflow
🌐
Node.js
nodejs.org › en › about › previous-releases
Node.js — Node.js Releases
Version Support: Must support all currently supported, non-End-of-Life (EOL) Node.js versions.
🌐
npm
npmjs.com › package › node
node - npm
node. Latest version: 24.12.0, last published: 5 days ago. Start using node in your project by running `npm i node`. There are 1132 other projects in the npm registry using node.
      » npm install node
    
Published   Dec 12, 2025
Version   24.12.0
Top answer
1 of 2
2

npm not being a build tool in itself (only handles dependencies and executes scripts), you may refer to unspecified build command and executable?

Our build pipeline is basically npm i followed by some custom node script.js then npm test, npm prune, npm audit etc.

  • npm test just executes your scripts.test command; if the underlying executable requires Node, it will use the binary specified in the PATH
  • npm prune and npm audit work on your dependencies and their version, irrespective of Node
  • node script.js obviously uses the corresponding Node version (here what is specified in the PATH)
  • npm install will install the package dependencies (and development dependencies), according to their specified versions; it is up to you to ensure compatibility of your dependencies version with your targeted Node version; if they specify some Node engines constraint, and the latter is not met by the version in PATH, it will only produce a warning (unless you set the engine-strict flag):

Unless the user has set the engine-strict config flag, this field is advisory only and will only produce warnings when your package is installed as a dependency.


That being said, with nvm you can at least use a specific node and npm version, for a single command, irrespective of the current system, terminal session or default node/npm version of your build server, using nvm exec <nodeVersion> npm <command>:

you can run any arbitrary command in a subshell with the desired version of node

(Or its associated npm version)

For example:

nvm exec 18 npm install # Will use the appropriate npm version for Node v18, and will see that Node v18 if needing Node

It actually launches a subshell and nvm use <version> under the hood, and executes your command there. Therefore these Node and npm versions may differ from the rest of the machine shells.

For example if a dependency has a prepare script that requires Node, it will get the version provided by nvm exec <version> after being npm install'ed.

2 of 2
0

unfortunately nvm is not "CI Friendly" as it is not a binary on the $PATH but a command (bash function) which must be loaded for every step of the pipeline. I think what we are looking for is a way to run specific, synchronized version of npm, npx and node.

Besides performing each build in a dedicated Docker container, you may be interested in Volta:

Volta keeps track of which project (if any) you’re working on based on your current directory. The tools in your Volta toolchain automatically detect when you’re in a project that’s using a particular version of the tools, and take care of routing to the right version of the tools for you.

And:

Volta does not use any fancy OS features or shell-specific hooks.

Volta replaces the node, npm, npx (and potentially many more) binaries by shims, which enable it to route to the appropriate version, based on what is specified in the package.json file of the project the binary is invoked from.

E.g. in your "NodeJS v20 apps", you would have:

// package.json
{
  "volta": {
    "node": "20"
  }
}

...and whenever node, npm or npx are called from within these project folders, they would use node 20 or the bundled version of npm and npx.

Without having to configure anything globally on your build machine for a particular build run or step.

🌐
GitHub
github.com › nodejs › node › issues › 50376
New LTS 20.9.0 uses npm 10.1.0 which has issues with proxy config · Issue #50376 · nodejs/node
October 24, 2023 - Also see https://github.com/nodejs/node/tree/v20.9.0/deps . The latest commit for npm clearly states that npm 10.1.0 is used.
Published   Oct 24, 2023
🌐
Node.js
nodejs.org › en › download
Node.js — Download Node.js®
with npm · InfoWant new features sooner? Get the latest Node.js version instead and try the latest improvements! BashCopy to clipboard and their installation scripts are not maintained by the Node.js project. If you encounter any issues please visit 's website ·
🌐
Node.js
nodejs.org › en › blog › release › v20.0.0
Node.js — Node.js v20.0.0 (Current)
The recent update to Node.js, version 20, includes an important change to the test_runner module. The module has been marked as stable after a recent update.
🌐
Node.js
nodejs.org › en › blog › announcements › v20-release-announce
Node.js — Node.js 20 is now available!
The recent update to Node.js, version 20, includes an important change to the test_runner module. The module has been marked as stable after a recent update.
Find elsewhere
🌐
GitHub
github.com › nodejs › node › blob › main › doc › changelogs › CHANGELOG_V20.md
node/doc/changelogs/CHANGELOG_V20.md at main · nodejs/node
[a19b28336b] - deps: update ada to 2.9.0 (Node.js GitHub Bot) #53748 · [2f66c7e707] - deps: upgrade npm to 10.8.2 (npm team) #53799
Author   nodejs
🌐
Redis
versionlog.com › nodejs › 20
Node.js 20: List Releases, Release Date, End of Life
Node.js 20.0.0 is a major version that brings experimental tools, speed boosts, and fresh dependencies. It adds a new Permission Model to limit access, makes the Test Runner stable for real-world use, and switches to the faster Ada 2.0 URL parser.
🌐
Stack Overflow
stackoverflow.com › questions › 78392254 › npm-run-all-does-not-work-for-node-20-and-npm-10
node.js - npm-run-all does not work for node 20 and npm 10 - Stack Overflow
ERROR: ERROR: npm v10.2.5 is known not to run on Node.js v14.17.3. This version of npm supports the following node versions: ^18.17.0 || >=20.5.0.
🌐
Node.js
nodejs.org › en › blog › release › v20.10.0
Node.js — Node.js v20.10.0 (LTS)
For “ambiguous” files, which are .js or extensionless files with no package.json with a type field, Node.js will parse the file to detect ES module syntax; if found, it will run the file as an ES module, otherwise it will run the file as a CommonJS module. The same applies to string input via --eval or STDIN. We hope to make detection enabled by default in a future version of Node.js.
🌐
npm
docs.npmjs.com › downloading-and-installing-node-js-and-npm
Downloading and installing Node.js and npm | npm Docs
We do not recommend using a Node installer, since the Node installation process installs npm in a directory with local permissions and can cause permissions errors when you run npm packages globally. Note: to download the latest version of npm, on the command line, run the following command:npm install -g npm
🌐
Node.js
nodejs.org › en › blog › release › v20.16.0
Node.js — Node.js v20.16.0 (LTS)
[8b5f1d765a] - deps: update zlib to 1.3.0.1-motley-209717d (Node.js GitHub Bot) #53156 · [fc73da6f50] - deps: update c-ares to v1.30.0 (Node.js GitHub Bot) #53416 · [a6b803abd6] - deps: update undici to 6.18.2 (Node.js GitHub Bot) #53255 · [0f235535bb] - deps: update ada to 2.8.0 (Node.js GitHub Bot) #53254 · [63407269a8] - deps: update corepack to 0.28.2 (Node.js GitHub Bot) #53253 · [7a126e8773] - deps: update c-ares to 1.29.0 (Node.js GitHub Bot) #53155 · [0c8fcceefa] - deps: upgrade npm to 10.8.1 (npm team) #53207 ·
🌐
Mise-en-place
mise.jdx.dev › lang › node.html
Node | mise-en-place
The following installs the latest version of node-20.x and makes it the global default:
🌐
npm
npmjs.com › package › npm
npm - npm
For a list of which versions of Node.js are currently supported, please see the Node.js releases page. npm comes bundled with node, & most third-party distributions, by default.
      » npm install npm
    
Published   Dec 09, 2025
Version   11.7.0
Author   GitHub Inc.
🌐
Medium
medium.com › @Games24x7Tech › node-js-v20-upgrade-guide-best-practices-and-performance-insights-f76d7ace09ff
Node.js v20 upgrade guide: Best Practices and Performance Insights | by Games24x7 Blogs | Medium
September 6, 2024 - Update your packages using npm update or by manually editing the package.json file to specify the required versions. If you’re using Node Version Manager (nvm), install and switch to Node.js 20 with the following commands:
🌐
Node.js
nodejs.org › en › blog › release › v20.9.0
Node.js — Node.js v20.9.0 (LTS)
This release marks the transition of Node.js 20.x into Long Term Support (LTS) with the codename 'Iron'. The 20.x release line now moves into "Active LTS" and will remain so until October 2024.
🌐
endoflife.date
endoflife.date › nodejs
Node.js | endoflife.date
1 week ago - Major Node.js versions enter Current release status for six months, which gives library authors time to add support for them. After six months, odd-numbered releases (9, 11, etc.) become unsupported, and even-numbered releases (10, 12, etc.) move to Active LTS status and are ready for general use.