修改Vercel构建时使用的Node版本

Vercel Node 版本的说明

官方参考:意思是设置了 engines.node 后,如果与项目的 node 版本不一致,则使用前者

Defining the node property inside engines of a package.json file will override the selection made in the Project Settings and print a Build Step warning if the version does not match. Please avoid greater than ranges, such as >14.x or >=14, because this will match semver major versions of Node.js once available which contains breaking changes.
For example, the range >16.2.0 would match the versions 16.2.5, 16.3.0, and 18.0.0.

通过 package.json 修改 node 版本

在 package.json 中通过 engines.node 指定 node 版本

{
  ....
  "engines": {
    "node": ">16.14.0 <17"
  },
  ...
}

在界面中修改项目的 Node 版本

注意:若使用 package.json 修改了 Node 版本,且与项目指定的版本不一致,则使用前者

参考:https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/node-js#node.js-version

posted @   EGU0  阅读(1042)  评论(1编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示