错误代码
你是插件作者,想要声明自己的错误代码,而这些错误代码与此处提供的语义不匹配吗?请放弃一个字符并使用 YNX
前缀(例如 YNX001
)而不是 YN0
!
¥Are you a plugin author and want to declare your own error codes that don't match the semantic of the ones provided here? Please relinquish one character and use the YNX
prefix (ex YNX001
) instead of YN0
!
遵守这一惯例将帮助我们的用户找出哪些错误代码可以在此文档中找到,哪些错误代码应该根据他们使用的插件的单独文档进行检查。
¥Keeping this convention will help our users to figure out which error codes can be found on this documentation and which ones should instead be checked against the individual documentation of the plugins they use.
YN0000 - UNNAMED
此代码用于记录常规消息,主要用于对齐 Yarn 输出中的所有行。不用担心!
¥This code is used to log regular messages, mostly to align all the lines in the Yarn output. No worry!
YN0001 - EXCEPTION
程序抛出了异常。
¥An exception had be thrown by the program.
此错误通常不应该发生(它应该指向此页面中的其他错误消息,以便可以正确记录),因此应将其视为 Yarn 中的错误。请随时打开问题,或者更好的是,提出旨在修复它的拉取请求。
¥This error typically should never happen (it should instead point to a different error message from this page so that it can be properly documented), so it should be considered a bug in Yarn. Feel free to open an issue or, even better, a pull request aiming to fix it.
YN0002 - MISSING_PEER_DEPENDENCY
包请求对等依赖,但依赖树中的一个或多个父级不提供它。
¥A package requests a peer dependency, but one or more of its parents in the dependency tree doesn't provide it.
请注意,Yarn 在依赖树的每个级别都强制执行对等依赖。也就是说,如果 ─D>
是依赖,而 ─P>
是同级依赖,
¥Note that Yarn enforces peer dependencies at every level of the dependency tree. That is, if ─D>
is a dependency and ─P>
is a peer dependency,
# bad
project
├─D> packagePeer
└─D> packageA
└─P> packageB
└─P> packagePeer
# good
project
├─D> packagePeer
└─D> packageA
├─P> packagePeer
└─D> packageB
└─P> packagePeer
根据你的情况,可能有多个选项:
¥Depending on your situation, multiple options are possible:
-
packageA
的作者可以通过在packagePeer
上添加对等依赖来解决此问题。如果相关,他们可以使用 可选的对等依赖 来实现此效果。¥The author of
packageA
can fix this problem by adding a peer dependency onpackagePeer
. If relevant, they can use optional peer dependencies to this effect. -
packageB
的作者可以通过将packagePeer
对等依赖标记为可选来解决此问题 - 但当然,前提是同级依赖实际上是可选的!¥The author of
packageB
can fix this problem by marking thepackagePeer
peer dependency as optional - but only if the peer dependency is actually optional, of course! -
project
的作者可以通过手动覆盖packageExtensions
配置选项 上的packageA
和/或packageB
定义来解决此问题。¥The author of
project
can fix this problem by manually overriding thepackageA
and/orpackageB
definitions via the