[Tools] Use pnpm as a Node.js version manager

Answer1215 / 2025-01-15 / 原文

Let's say for the laptop, default node version is 20.17.0, if you want the project to use 20.18.0with pnpm, you can do

// use node 20.18.0
pnpm env use -g 20.18.0

 

or, create a .npmrcfile

use-node-version=23.0.0

When run pnpm start, it will automatically pick up the node version, if you haven't install it yet, pnpm will help to fetch and install the node version