错误参考
以下参考是你在使用 Astro 时可能遇到的错误的完整列表。如需更多帮助,包括常见陷阱,请参阅我们的故障排除指南。
Astro 错误
名为“Astro 错误”的部分- UnknownCompilerError
未知的编译器错误。 - ClientAddressNotAvailable
Astro.clientAddress
在当前适配器中不可用。 - PrerenderClientAddressNotAvailable
Astro.clientAddress
不能在预渲染路由内部使用。 - StaticClientAddressNotAvailable
Astro.clientAddress
在预渲染页面中不可用。 - NoMatchingStaticPathFound
未找到请求路径的静态路径。 - OnlyResponseCanBeReturned
Astro 页面返回了无效的类型。 - MissingMediaQueryDirective
缺少client:media
指令的值。 - NoMatchingRenderer
未找到匹配的渲染器。 - NoClientEntrypoint
渲染器中未指定客户端入口点。 - NoClientOnlyHint
client:only
指令上缺少提示。 - InvalidGetStaticPathParam
getStaticPaths
路径返回了无效的值。 - InvalidGetStaticPathsEntry
getStaticPath 的返回值中存在无效条目 - InvalidGetStaticPathsReturn
getStaticPaths 返回了无效的值。 - GetStaticPathsExpectedParams
getStaticPaths
路由缺少 params 属性。 - GetStaticPathsInvalidRouteParam
getStaticPaths
路由参数的值无效。 - GetStaticPathsRequired
动态路由需要getStaticPaths()
函数。 - ReservedSlotName
无效的插槽名称。 - NoAdapterInstalled
没有适配器无法使用服务器端渲染。 - AdapterSupportOutputMismatch
适配器不支持服务器输出。 - NoAdapterInstalledServerIslands
没有适配器无法使用服务器岛。 - NoMatchingImport
未找到组件的导入。 - InvalidPrerenderExport
无效的预渲染导出。 - InvalidComponentArgs
无效的组件参数。 - PageNumberParamNotFound
未找到页码参数。 - ImageMissingAlt
图片缺少必需的“alt”属性。 - InvalidImageService
加载图像服务时出错。 - MissingImageDimension
缺少图像尺寸 - FailedToFetchRemoteImageDimensions
无法检索远程图像尺寸 - UnsupportedImageFormat
不支持的图像格式 - UnsupportedImageConversion
不支持的图像转换 - PrerenderDynamicEndpointPathCollide
预渲染的动态端点存在路径冲突。 - ExpectedImage
期望 src 是一个图像。 - ExpectedImageOptions
期望图像选项。 - ExpectedNotESMImage
期望图像选项,而不是 ESM 导入的图像。 - IncompatibleDescriptorOptions
不能同时设置densities
和widths
- ImageNotFound
未找到图像。 - NoImageMetadata
无法处理图像元数据。 - CouldNotTransformImage
无法转换图像。 - ResponseSentError
无法设置响应。 - MiddlewareNoDataOrNextCalled
中间件没有返回一个Response
。 - MiddlewareNotAResponse
中间件返回的内容不是一个Response
对象。 - EndpointDidNotReturnAResponse
端点没有返回一个Response
。 - LocalsNotAnObject
分配给locals
的值不被接受。 - LocalsReassigned
locals
不能被重新分配。 - AstroResponseHeadersReassigned
Astro.response.headers
不能被重新分配。 - MiddlewareCantBeLoaded
无法加载中间件。 - LocalImageUsedWrongly
本地图像必须被导入。 - AstroGlobUsedOutside
Astro.glob() 在 Astro 文件之外使用。 - AstroGlobNoMatch
Astro.glob() 没有匹配到任何文件。 - RedirectWithNoLocation
重定向必须通过Location
标头指定一个位置。 - UnsupportedExternalRedirect
不支持或格式错误的 URL。 - InvalidDynamicRoute
无效的动态路由。 - MissingSharp
找不到 Sharp。 - UnknownViteError
未知的 Vite 错误。 - FailedToLoadModuleSSR
无法导入文件。 - InvalidGlob
无效的 glob 模式。 - FailedToFindPageMapSSR
Astro 找不到要渲染的正确页面 - MissingLocale
提供的区域设置不存在。 - MissingIndexForInternationalization
找不到索引页面。 - IncorrectStrategyForI18n
你不能在当前策略下使用当前函数 - NoPrerenderedRoutesWithDomains
启用国际化域名时不支持预渲染路由。 - MissingMiddlewareForInternationalization
启用了手动国际化路由但没有中间件。 - CantRenderPage
Astro 无法渲染该路由。 - UnhandledRejection
未处理的拒绝 - i18nNotEnabled
i18n 未启用 - i18nNoLocaleFoundInPath
路径不包含任何区域设置 - RouteNotFound
未找到路由。 - EnvInvalidVariables
无效的环境变量 - ServerOnlyModule
模块仅在服务器端可用 - RewriteWithBodyUsed
读取请求体后不能使用 Astro.rewrite - ForbiddenRewrite
禁止重写到静态路由。 - UnknownFilesystemError
在向磁盘读写文件时发生未知错误。 - CannotExtractFontType
无法从给定的 URL 中提取字体类型。 - CannotDetermineWeightAndStyleFromFontFile
无法从字体文件中确定字重和样式。 - CannotFetchFontFile
无法获取给定的字体文件。 - CannotLoadFontProvider
无法加载字体提供程序 - ExperimentalFontsNotEnabled
实验性字体未启用 - FontFamilyNotFound
找不到字体家族 - CspNotEnabled
CSP 功能未启用
CSS 错误
名为“CSS 错误”的部分- UnknownCSSError
未知的 CSS 错误。 - CSSSyntaxError
CSS 语法错误。
Markdown 错误
名为“Markdown 错误”的部分- UnknownMarkdownError
未知的 Markdown 错误。 - MarkdownFrontmatterParseError
解析 Markdown frontmatter 失败。 - InvalidFrontmatterInjectionError
无效的 frontmatter 注入。 - MdxIntegrationMissingError
缺少 MDX 集成。 - UnknownConfigError
未知的配置错误。 - ConfigNotFound
找不到指定的配置文件。 - ConfigLegacyKey
检测到旧版配置。
CLI 错误
名为“CLI 错误”的部分- UnknownCLIError
未知的 CLI 错误。 - GenerateContentTypesError
生成内容类型失败。
内容集合错误
名为“内容集合错误”的部分- UnknownContentCollectionError
未知的内容集合错误。 - RenderUndefinedEntryError
尝试渲染未定义的内容集合条目。 - GetEntryDeprecationError
无效使用getDataEntryById
或getEntryBySlug
函数。 - InvalidContentEntryFrontmatterError
内容条目的 frontmatter 与 schema 不匹配。 - InvalidContentEntryDataError
内容条目的数据与 schema 不匹配。 - ContentLoaderReturnsInvalidId
内容加载器返回了一个id
无效的条目。 - ContentEntryDataError
内容条目的数据与 schema 不匹配。 - LiveContentConfigError
实时内容配置错误。 - ContentLoaderInvalidDataError
内容条目缺少 ID - InvalidContentEntrySlugError
无效的内容条目 slug。 - ContentSchemaContainsSlugError
内容 Schema 不应包含slug
。 - MixedContentDataCollectionError
内容和数据不能在同一个集合中。 - ContentCollectionTypeMismatchError
集合包含不同类型的条目。 - DataCollectionEntryParseError
数据集合条目解析失败。 - DuplicateContentEntrySlugError
重复的内容条目 slug。 - UnsupportedConfigTransformError
内容配置中不支持的转换。 - FileParserNotFound
找不到文件解析器 - FileGlobNotSupported
文件加载器不支持 Glob 模式
Action 错误
名为“Action 错误”的部分- ActionsWithoutServerOutputError
Actions 必须与服务器输出一起使用。 - ActionsReturnedInvalidDataError
Action 处理程序返回了无效的数据。 - ActionNotFoundError
未找到 Action。 - ActionCalledFromServerError
Action 从服务器意外调用。 - ActionsCantBeLoaded
无法加载 Astro actions。
会话错误
名为“会话错误”的部分- SessionStorageInitError
会话存储无法初始化。 - SessionStorageSaveError
会话数据无法保存。 - SessionWithoutSupportedAdapterOutputError
会话不能与不支持服务器输出的适配器一起使用。 - SessionConfigMissingError
会话存储已启用但未配置。 - SessionConfigWithoutFlagError
未设置会话标志