首页 > 解决方案 > 错误:`revalidate` 属性还不能用于一般用途

问题描述

我的 package.json 文件是

{
  "name": "learn-starter",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "export": "next export"
  },
  "dependencies": {
    "@tailwindcss/typography": "^0.2.0",
    "date-fns": "^2.16.1",
    "geolib": "^3.3.1",
    "google-map-react": "^2.1.3",
    "graphql": "^15.3.0",
    "graphql-request": "3.0.0",
    "gray-matter": "^4.0.2",
    "isomorphic-unfetch": "^3.0.0",
    "libphonenumber-js": "^1.7.57",
    "next": "9.3.5",
    "next-seo": "^4.7.3",
    "react": "16.13.1",
    "react-animated-css": "^1.2.1",
    "react-dom": "16.13.1",
    "react-gtm-module": "^2.0.11",
    "react-static-google-map": "^0.6.2",
    "remark": "^12.0.1",
    "remark-html": "^12.0.0",
    "tailwindcss": "^1.7.6",
    "use-position": "^0.0.7"
  },
  "devDependencies": {}
}

我正在尝试在 getStaticProps 中使用 revaildate: 1 但我收到错误消息

Error: The `revalidate` property is not yet available for general use.
To try the experimental implementation, please use `unstable_revalidate` instead.

正如我在 package.json 文件中看到的那样,我的 nextjs 版本是 9.3.5 谁能帮我解决这个问题。

标签: next.js

解决方案


尝试使用“unstable_revalidate”而不是“revalidate”,因为在 nextjs 版本 <9.5 中,“revalidate”关键字尚未通用。


推荐阅读