avatar
Notion踩坑记
🏷️

Notion踩坑记

keywords
published_date
最新编辑 2024年09月08日
Created time
2024年08月06日
slug
记录实际开发中遇到Notion的报错问题
tags
Notion

问题1

notion api 获取到的relation 是空
解决方案
需要将relation的数据库connections到原项目
notion image

问题2

npm run dev的时候一切正常,在部署的时候报错:path.database_id should be a valid uuid, instead was \\"undefined\\"
解决方案
Vercel 不会自动读取 .env 文件,需要手动配置环境变量。
检查 Vercel 环境变量
确保在 Vercel 项目的设置中,所有必要的环境变量都已正确配置。特别是 NOTION_TOKENNOTION_DATABASE_ID
  1. 登录到 Vercel 控制台。
  1. 选择你的项目。
  1. 转到“Settings” -> “Environment Variables”。
  1. 确认 NOTION_TOKENNOTION_DATABASE_ID 都已正确设置。

问题3

在npm run build的时候。Type error: Could not find a declaration file for module 'prismjs/components/prism-markup-templating.js'. '/Users/jessie.chen/project/jessie-blog.dev/node_modules/prismjs/components/prism-markup-templating.js' implicitly has an 'any' type.
解决方案
这是一个常见的 TypeScript 错误,提示 prismjs 模块缺少类型声明。
  1. 安装类型声明文件(如果存在):
npm install --save-dev @types/prismjs
  1. 手动添加模块声明文件: 在项目的根目录下创建一个global.d.ts文件,并在其中添加以下内容:
declare module "prismjs/components/prism-markup-templating.js"; declare module "prismjs/components/prism-markup.js"; declare module "prismjs/components/prism-bash.js"; declare module "prismjs/components/prism-c.js"; declare module "prismjs/components/prism-cpp.js"; declare module "prismjs/components/prism-csharp.js"; declare module "prismjs/components/prism-docker.js"; declare module "prismjs/components/prism-java.js"; declare module "prismjs/components/prism-js-templates.js"; declare module "prismjs/components/prism-coffeescript.js"; declare module "prismjs/components/prism-diff.js"; declare module "prismjs/components/prism-git.js"; declare module "prismjs/components/prism-go.js"; declare module "prismjs/components/prism-graphql.js"; declare module "prismjs/components/prism-handlebars.js"; declare module "prismjs/components/prism-less.js"; declare module "prismjs/components/prism-makefile.js"; declare module "prismjs/components/prism-markdown.js"; declare module "prismjs/components/prism-objectivec.js"; declare module "prismjs/components/prism-ocaml.js"; declare module "prismjs/components/prism-python.js"; declare module "prismjs/components/prism-reason.js"; declare module "prismjs/components/prism-rust.js"; declare module "prismjs/components/prism-sass.js"; declare module "prismjs/components/prism-scss.js"; declare module "prismjs/components/prism-solidity.js"; declare module "prismjs/components/prism-sql.js"; declare module "prismjs/components/prism-stylus.js"; declare module "prismjs/components/prism-swift.js"; declare module "prismjs/components/prism-wasm.js"; declare module "prismjs/components/prism-yaml.js";
  1. 完成这些步骤后,再次运行 npm run build
 

关于我

My desire to practice my skills and share my acquired knowledge fuels my endeavors.

联系 : znjessie858@gmail.com

订阅

订阅我的文章,收到我的最新发布通知,可随时取消订阅!