在Vercel无服务器函数上部署NUXT SSR通用应用

发布于 2025-02-06 22:38:42 字数 509 浏览 2 评论 0原文

我正在尝试在Vercel上托管使用NUXT 2构建的通用SSR应用程序。

这是 project repo ,项目总尺寸为6MB,

但是当我试图构建Vercel时,它会给它提供此功能。错误

错误:无服务器函数“索引”为124.58MB,超过50MB的最大尺寸限制。了解更多信息:https://vercel.link/serverless-function-size

错误

“

I'm trying to host a universal ssr app built with nuxt 2 on vercel.

Here's the Project Repo, The project total size is about 6mb

But when i try to build vercel it gives this error

Error: The Serverless Function "index" is 124.58mb which exceeds the maximum size limit of 50mb. Learn More: https://vercel.link/serverless-function-size

a screenshot of the error

Vercel Error

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酸甜透明夹心 2025-02-13 22:38:42

我知道已经回答了这个问题已经过去了几个月,但我也想做出贡献,也完成了同样的NUXT课程。

我将Vercel-Builder版本更改为0.22.1,如GitHub上提议的0.22.1: https ://github.com/nuxt/vercel-builder/issues/633

{
  "version": 2,
  "builds": [
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/[email protected]",
      //...
    }
  ]
}

至于2022年11月,这解决了问题。

I know it's been some months since the question was answered but I wanted to contribute as well, having finished the same Nuxt course as well.

I changed the vercel-builder version to 0.22.1 as proposed on this issue on github: https://github.com/nuxt/vercel-builder/issues/633

{
  "version": 2,
  "builds": [
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/[email protected]",
      //...
    }
  ]
}

As for November 2022 this solved the issue.

阳光下慵懒的猫 2025-02-13 22:38:42

在这里无需添加,无服务器功能是轻巧的,并且具有很少的依赖性。

虽然NUXT2应用程序带有节点模块和很多内容。这不是无服务器功能的正确用法。

另外,如果您使用ssr带有target:'server',则您将需要一个node.js实例运行,因此Vercel也不适合。像Heroku这样的东西更适合。
如果您仅使用SSG(`target:'static'),则可以。

Nothing more to add here, a serverless function is meant to lightweight and with a very few dependencies.

While a Nuxt2 app comes with node modules and a lot of things. This is not the correct usage of a serverless function.

Also, if you're using ssr with target: 'server', you will need a node.js instance running anyways, so Vercel does not fit either. Something like Heroku is more adapted.
If you only use SSG (`target: 'static'), it may be fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文