Skip to main content
Version: 9.x

错误代码

ERR_PNPM_UNEXPECTED_STORE

存在模块目录并链接到不同的存储目录。

¥A modules directory is present and is linked to a different store directory.

如果你有意更改存储目录,请运行 pnpm install,pnpm 将使用新存储重新安装依赖。

¥If you changed the store directory intentionally, run pnpm install and pnpm will reinstall the dependencies using the new store.

ERR_PNPM_NO_MATCHING_VERSION_INSIDE_WORKSPACE

项目具有工作区中不存在的工作区依赖。

¥A project has a workspace dependency that does not exist in the workspace.

例如,包 foodependencies 中有 bar@1.0.0

¥For instance, package foo has bar@1.0.0 in the dependencies:

{
"name": "foo",
"version": "1.0.0",
"dependencies": {
"bar": "workspace:1.0.0"
}
}

但是,工作区中只有 bar@2.0.0,因此 pnpm install 会失败。

¥However, there is only bar@2.0.0 in the workspace, so pnpm install will fail.

要修复此错误,应更新所有使用 工作区协议 的依赖以使用工作区中存在的包版本。这可以手动或使用 pnpm -r update 命令完成。

¥To fix this error, all dependencies that use the workspace protocol should be updated to use versions of packages that are present in the workspace. This can be done either manually or using the pnpm -r update command.

ERR_PNPM_PEER_DEP_ISSUES

如果项目具有未解决的对等依赖或对等依赖与所需范围不匹配,pnpm install 将失败。要解决此问题,请安装缺少的对等依赖。

¥pnpm install will fail if the project has unresolved peer dependencies or the peer dependencies are not matching the wanted ranges. To fix this, install the missing peer dependencies.

你还可以使用 package.json 中的 pnpm.peerDependencyRules.ignoreMissingpnpm.peerDependencyRules.allowedVersions 字段选择性地忽略这些错误。

¥You may also selectively ignore these errors using the pnpm.peerDependencyRules.ignoreMissing and pnpm.peerDependencyRules.allowedVersions fields in package.json.

ERR_PNPM_OUTDATED_LOCKFILE

如果不更改锁定文件就无法执行安装,则会发生此错误。如果有人更改了存储库中的 package.json 文件但随后没有运行 pnpm install,则在 CI 环境中可能会发生这种情况。或者有人忘记将更改提交到锁定文件。

¥This error happens when installation cannot be performed without changes to the lockfile. This might happen in a CI environment if someone has changed a package.json file in the repository without running pnpm install afterwards. Or someone forgot to commit the changes to the lockfile.

要修复此错误,只需运行 pnpm install 并将更改提交到锁定文件。

¥To fix this error, just run pnpm install and commit the changes to the lockfile.

ERR_PNPM_TARBALL_INTEGRITY

此错误表明下载的包的 tarball 与预期的完整性校验和不匹配。

¥This error indicates that the downloaded package's tarball did not match the expected integrity checksum.

如果你使用 npm 注册表 (registry.npmjs.org),那么这可能意味着你的锁定文件的完整性不正确。如果锁定文件未能很好地解决合并冲突,则可能会发生这种情况。

¥If you use the npm registry (registry.npmjs.org), then this probably means that the integrity in your lockfile is incorrect. This might happen if a lockfile had badly resolved merge conflicts.

如果你使用允许覆盖包的现有版本的注册表,则可能意味着在本地元数据缓存中你拥有旧版本包的完整性校验和。在这种情况下,你应该运行 pnpm store prune。此命令将删除你的本地元数据缓存。然后你可以重试失败的命令。

¥If you use a registry that allows to override existing versions of a package, then it might mean that in your local metadata cache you have the integrity checksum of an older version of the package. In this case, you should run pnpm store prune. This command will remove your local metadata cache. Then you can retry the command that failed.

但也要小心并验证该包是否是从正确的 URL 下载的。URL 应打印在错误消息中。

¥But also be careful and verify that the package is downloaded from the right URL. The URL should be printed in the error message.

ERR_PNPM_MISMATCHED_RELEASE_CHANNEL

配置字段 use-node-version 定义了与版本后缀不同的发布通道。

¥The config field use-node-version defines a release channel different from version suffix.

例如:

¥For example:

  • rc/20.0.0 定义了 rc 通道,但版本是稳定版本。

    ¥rc/20.0.0 defines an rc channel but the version is that of a stable release.

  • release/20.0.0-rc.0 定义了 release 通道,但版本是 RC 版本。

    ¥release/20.0.0-rc.0 defines a release channel but the version is that of an RC release.

要修复此错误,请删除发布通道前缀或更正版本后缀。

¥To fix this error, either remove the release channel prefix or correct the version suffix.

ERR_PNPM_INVALID_NODE_VERSION

配置字段 use-node-version 的值具有无效语法。

¥The value of config field use-node-version has an invalid syntax.

以下是 use-node-version 的有效形式:

¥Below are the valid forms of use-node-version:

  • 稳定发布:

    ¥Stable release:

    • X.Y.ZXYZ 为整数)

      ¥X.Y.Z (X, Y, Z are integers)

    • release/X.Y.ZXYZ 为整数)

      ¥release/X.Y.Z (X, Y, Z are integers)

  • RC 版本:

    ¥RC release:

    • X.Y.Z-rc.WXYZW 为整数)

      ¥X.Y.Z-rc.W (X, Y, Z, W are integers)

    • rc/X.Y.Z-rc.WXYZW 为整数)

      ¥rc/X.Y.Z-rc.W (X, Y, Z, W are integers)