ERR_PNPM_FETCH_404 报错的解决方式

今天尝试使用 github 的 actions 来自动编译代码。偶然发现在用 pnpm 安装依赖的步骤会出现 ERR_PNPM_FETCH_404 的错误。

Progress: resolved 1084, reused 955, downloaded 0, added 1038
 WARN  GET https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/download/@webassemblyjs/floating-point-hex-parser-1.11.1.tgz error (ERR_PNPM_FETCH_404). Will retry in 1 minute. 1 retries left.
 WARN  GET https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/download/@webassemblyjs/helper-wasm-section-1.11.1.tgz error (ERR_PNPM_FETCH_404). Will retry in 1 minute. 1 retries left.
 WARN  GET https://registry.npmjs.org/@webassemblyjs/helper-numbers/download/@webassemblyjs/helper-numbers-1.11.1.tgz error (ERR_PNPM_FETCH_404). Will retry in 1 minute. 1 retries left.
 WARN  GET https://registry.npmjs.org/@webassemblyjs/wasm-edit/download/@webassemblyjs/wasm-edit-1.11.1.tgz error (ERR_PNPM_FETCH_404). Will retry in 1 minute. 1 retries left.
 WARN  GET https://registry.npmjs.org/@webassemblyjs/utf8/download/@webassemblyjs/utf8-1.11.1.tgz error (ERR_PNPM_FETCH_404). Will retry in 1 minute. 1 retries left.
 WARN  GET https://registry.npmjs.org/@webassemblyjs/helper-buffer/download/@webassemblyjs/helper-buffer-1.11.1.tgz error (ERR_PNPM_FETCH_404). Will retry in 1 minute. 1 retries left.
 WARN  GET https://registry.npmjs.org/@webassemblyjs/leb128/download/@webassemblyjs/leb128-1.11.1.tgz error (ERR_PNPM_FETCH_404). Will retry in 1 minute. 1 retries left.
 WARN  GET https://registry.npmjs.org/@webassemblyjs/helper-api-error/download/@webassemblyjs/helper-api-error-1.11.1.tgz error (ERR_PNPM_FETCH_404). Will retry in 1 minute. 1 retries left.
 WARN  GET https://registry.npmjs.org/@xtuc/long/download/@xtuc/long-4.2.2.tgz error (ERR_PNPM_FETCH_404). Will retry in 1 minute. 1 retries left.
 WARN  GET https://registry.npmjs.org/@webassemblyjs/wasm-gen/download/@webassemblyjs/wasm-gen-1.11.1.tgz error (ERR_PNPM_FETCH_404). Will retry in 1 minute. 1 retries left.
 WARN  GET https://registry.npmjs.org/@webassemblyjs/ieee754/download/@webassemblyjs/ieee754-1.11.1.tgz error (ERR_PNPM_FETCH_404). Will retry in 1 minute. 1 retries left.
 WARN  GET https://registry.npmjs.org/@webassemblyjs/ast/download/@webassemblyjs/ast-1.11.1.tgz error (ERR_PNPM_FETCH_404). Will retry in 1 minute. 1 retries left.
 WARN  GET https://registry.npmjs.org/@webassemblyjs/wasm-opt/download/@webassemblyjs/wasm-opt-1.11.1.tgz error (ERR_PNPM_FETCH_404). Will retry in 1 minute. 1 retries left.
 WARN  GET https://registry.npmjs.org/@webassemblyjs/wasm-parser/download/@webassemblyjs/wasm-parser-1.11.1.tgz error (ERR_PNPM_FETCH_404). Will retry in 1 minute. 1 retries left.
 WARN  GET https://registry.npmjs.org/@webassemblyjs/wast-printer/download/@webassemblyjs/wast-printer-1.11.1.tgz error (ERR_PNPM_FETCH_404). Will retry in 1 minute. 1 retries left.
 WARN  GET https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/download/@webassemblyjs/helper-wasm-bytecode-1.11.1.tgz error (ERR_PNPM_FETCH_404). Will retry in 1 minute. 1 retries left.
 ERR_PNPM_FETCH_404  GET https://registry.npmjs.org/@webassemblyjs/helper-api-error/download/@webassemblyjs/helper-api-error-1.11.1.tgz: Not Found - 404

搜索发现是因为我本地使用了淘宝源 https://registry.npmmirror.com/ 的原因,依赖的下载地址有些不标准,淘宝的地址中 含有 download 而 npmjs 中对应的 路径用的的 -,所以解决方法很多,只要保证两边使用的源一致即可。

为了在本地依旧能使用淘宝源,最终在使用 pnpm 安装依赖的执行代码改为 pnpm config set registry https://registry.npmmirror.com/ && pnpm install,至此问题解决。

类似文章

2条评论

  1. ERR_PNPM_FETCH_404 报错的解决方式, 这个能具体的说明下吗?
    我这边没有找到npmjs这个文件
    而且制品库中有的有—,有的是- 和 download,但是npm下载成功,pnpm下载失败。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注