---
title: "归纳在Vercel平台部署项目的注意事项 | Kaz"
description: 暫無摘要
canonical_url: "https://unmei.fun/zh-Hant/blog/202607062301"
locale: zh-Hant
meta:
  "og:description": page.blog.202607062301.desc
  "og:image": "https://unmei.fun/favicon.svg"
  "og:image:height": "630"
  "og:image:width": "1200"
  "og:title": page.blog.202607062301.title
---

> Index of every page on this site: [llms.txt](https://unmei.fun/llms.txt)

當前頁面所支持的語言：

简体中文

# **归纳在Vercel平台部署项目的注意事项**

字數 1032

大約耗時 4 minutes

2026年7月6日週一 15:01:00 \[UTC]

## 避免构建缓存导致渲染错误

### 问题现象

在 `Nuxt` 项目中使用 `nuxt-content` 模块时，该模块会在构建阶段把 Markdown 渲染成 HTML。但 Vercel 部署时默认会复用上一次的构建缓存，导致 **Markdown 没有被正确重新渲染**：部署日志显示成功，实际访问页面却返回 500。

当时唯一的临时办法是重新部署时手动取消勾选「使用缓存」，但每次都要这样操作太麻烦。

### 原因

`nuxt-content` 的渲染结果属于构建产物，而缓存可能保留了上一次构建中已经生成的旧内容或中间文件。当内容源发生变化、但缓存命中的部分没有随之更新时，就会出现构建产物与实际内容不一致的情况。

### 解决方法

参考 [**Vercel 官方文档 - 管理构建缓存**](https://vercel.com/docs/deployments/troubleshoot-a-build#managing-build-cache)，在项目中加入环境变量，强制每次构建都跳过缓存：

1. 进入 Vercel 项目的环境变量配置页面：

   ```text
   https://vercel.com/用户名/项目名/settings/environments/production
   ```

2. 添加环境变量：

   ```text
   VERCEL_FORCE_NO_BUILD_CACHE=1
   ```

3. 重新部署一次，使配置生效。

### 补充说明

- 关闭构建缓存会增加每次部署的耗时，属于「用时间换正确性」的取舍。
- 如果只是偶尔出现渲染异常，也可以先保留缓存，在内容更新后手动触发一次无缓存部署。
- 类似的构建缓存问题并不只出现在 `nuxt-content` 上，任何依赖构建阶段生成静态产物的模块都需要留意。

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://unmei.fun/zh-Hant#website","@type":"WebSite","inLanguage":"zh-Hant","name":"HomePage","url":"https://unmei.fun/zh-Hant","translationOfWork":{"@id":"https://unmei.fun/#website"}},{"@id":"https://unmei.fun/zh-Hant/blog/202607062301#webpage","@type":"WebPage","description":"暫無摘要","name":"归纳在Vercel平台部署项目的注意事项","url":"https://unmei.fun/zh-Hant/blog/202607062301","breadcrumb":{"@id":"https://unmei.fun/zh-Hant/blog/202607062301#/schema/breadcrumb-list/#breadcrumb"},"isPartOf":{"@id":"https://unmei.fun/zh-Hant#website"},"potentialAction":[{"@type":"ReadAction","target":["https://unmei.fun/zh-Hant/blog/202607062301"]}]},{"@id":"https://unmei.fun/zh-Hant/blog/202607062301#/schema/breadcrumb-list/#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://unmei.fun/zh-hant","position":1},{"@type":"ListItem","name":"Blog","item":"https://unmei.fun/zh-hant/blog","position":2},{"@type":"ListItem","name":"202607062301","item":"https://unmei.fun/zh-hant/blog/202607062301","position":3}]}]}
```

## Sitemap

See the full [sitemap](https://unmei.fun/sitemap.md) for all pages.
