在项目中管理 Node.js 版本
在项目中管理 Node.js 版本
方式一
在项目根目录的 .node-version
文件中设置。
20.11.1
执行 fnm install
会安装 Node.js v20.11.1 版本 (如未安装)。 执行 fnm use
切换到 Node.js v20.11.1 版本。
方式二
{
"engines": {
"node": ">=20 <21"
}
}
执行 fnm install
会安装 Node.js v20.x.x 最新版本 (如未安装)。 执行 fnm use
切换到 Node.js v20.x.x 最新版本。