[Bug] Wrangler deployment fails due to unresolved "safer-buffer" dependency in iconv-lite
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- node.js, typescript
- 领域
- build-system, devops
调研方向
首先检查部署报告中提到的依赖声明和 Wrangler 配置,然后追踪在执行 pnpm run deploy 时如何包含 iconv-lite。先运行 pnpm install,再运行 pnpm run deploy 以复现问题,并检查是否缺少 safer-buffer 或需要 Wrangler 别名。部署包能够解析该依赖,且 Wrangler 能继续越过报告中的构建错误时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Please confirm the following
- I confirm my description is clear and polite, that I have provided the necessary diagnostic information, and that this is reproducible on the latest version.
- I confirm I have checked the relevant documentation and existing issues / discussions, and this report is not a duplicate.
- I confirm this is an issue with the Worker project, not caused by network or user error, and not an issue specific to the Go version.
- I confirm I have read the open-source license / disclaimers / usage policy, and understand that I bear all risks of use.
Version (required)
82bd05d
Platform (required)
Cloudflare Workers
DB_FORMAT (required)
map (single JSON blob)
DB_DRIVER (required)
auto
Storage Driver (required)
NONE
Bug Description (required)
Steps to reproduce:
- Clone the
OpenList-Workerrepository. - Install dependencies using
pnpm install. - Run the deployment command:
pnpm run deploy.
Expected result:
The project should bundle successfully and deploy to Cloudflare Workers without errors.
Actual behavior:
The build process fails during the npx wrangler deploy step. Wrangler reports multiple errors stating it cannot resolve the safer-buffer module, which is a dependency of iconv-lite. The error message suggests adding an alias to the Wrangler configuration, but the current project config does not include this fix.
Error Information (required)
The full deploy log:
❯ pnpm run deploy
$ node scripts/deploy.js
[KV] wrangler.jsonc 已声明 KV 绑定(省略 id 字段),由 wrangler 自动创建/复用。
[构建] 正在获取官方前端构建产物 ...
$ node scripts/fetch-frontend.mjs
[fetch-frontend] Fetching official frontend build artifacts...
Querying registry: https://registry.npmjs.org (@openlist-frontend/openlist-frontend)
Downloading published dist: @openlist-frontend/[email protected]
> curl -fL --retry 3 -o "/tmp/openlist-frontend-npm-WXMmDl/pkg.tgz" "https://registry.npmjs.org/@openlist-frontend/openlist-frontend/-/openlist-frontend-4.2.8.tgz"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
74 31.41M 74 23.47M 0 0 384.7k 0 01:23 01:02 00:21 214.8k 75 31.41M 75 23.64M 0 0 381.1k 0 01:24 01:03 76 31.41M 76 23.95M 0 0 380.1k 0 01:24 01:04 77 31.41M 77 24.18M 0 0 376.6k 0 01:25 01:05 77 31.41M 77 24.34M 0 0 368.4k 0 01:27 01:07 78 31.41M 78 24.53M 0 0 365.5k 0 01:27 01:08 78 31.41M 78 24.70M 0 0 361.4k 0 01:28 01:09 79 31.41M 79 24.92M 0 0 358.9k 0 01:29 01:11 79 31.41M 79 25.05M 0 0 355.6k 0 01:30 01:12 79 31.41M 79 25.05M 0 0 350.7k 0 01:31 01:13 80 31.41M 80 25.36M 0 0 350.2k 0 01:31 01:14 81 31.41M 81 25.52M 0 0 346.4k 0 01:32 01:15 81 31.41M 81 25.68M 0 0 343.7k 0 01:33 01:16 82 31.41M 82 25.96M 0 0 338.8k 0 01:34 01:18 83 31.41M 83 26.16M 0 0 334.4k 0 01:36 01:20 83 31.41M 83 26.35M 0 0 332.0k 0 01:36 01:21 84 31.41M 84 26.39M 0 0 327.6k 0 01:38 01:22 84 31.41M 84 26.63M 0 0 326.0k 0 01:38 01:23 85 31.41M 85 26.74M 0 0 323.3k 0 01:39 01:24 85 31.41M 85 26.88M 0 0 320.9k 0 01:40 01:25 85 31.41M 85 26.99M 0 0 318.5k 0 01:40 01:26 86 31.41M 86 27.08M 0 0 314.0k 0 01:42 01:28 86 31.41M 86 27.25M 0 0 312.0k 0 01:43 01:29 87 31.41M 87 27.36M 0 0 309.3k 0 01:43 01:30 87 31.41M 87 27.52M 0 0 305.9k 0 01:45 01:32 88 31.41M 88 27.70M 0 0 303.6k 0 01:45 01:33 88 31.41M 88 27.81M 0 0 301.0k 0 01:46 01:34 89 31.41M 89 28.00M 0 0 298.6k 0 01:47 01:36 89 31.41M 89 28.14M 0 0 296.8k 0 01:48 01:37 89 31.41M 89 28.24M 0 0 294.2k 0 01:49 01:38 90 31.41M 90 28.36M 0 0 292.3k 0 01:50 01:39 90 31.41M 90 28.45M 0 0 290.0k 0 01:50 01:40 91 31.41M 91 28.62M 0 0 287.1k 0 01:52 01:42 91 31.41M 91 28.75M 0 0 285.1k 0 01:52 01:43 91 31.41M 91 28.84M 0 0 283.2k 0 01:53 01:44 92 31.41M 92 28.92M 0 0 280.9k 0 01:54 01:45 92 31.41M 92 29.04M 0 0 279.0k 0 01:55 01:46 92 31.41M 92 29.11M 0 0 276.8k 0 01:56 01:47 92 31.41M 92 29.14M 0 0 274.4k 0 01:57 01:48 93 31.41M 93 29.29M 0 0 273.2k 0 01:57 01:49 93 31.41M 93 29.39M 0 0 271.4k 0 01:58 01:50 93 31.41M 93 29.50M 0 0 269.2k 0 01:59 01:52 94 31.41M 94 29.59M 0 0 266.7k 0 02:00 01:53 94 31.41M 94 29.72M 0 0 265.1k 0 02:01 01:54 94 31.41M 94 29.81M 0 0 263.6k 0 02:01 01:55 95 31.41M 95 29.88M 0 0 261.8k 0 02:02 01:56 95 31.41M 95 30.03M 0 0 260.4k 0 02:03 01:58 95 31.41M 95 30.10M 0 0 257.5k 0 02:04 01:59 96 31.41M 96 30.23M 0 0 255.3k 0 02:05 02:01 96 31.41M 96 30.33M 0 0 253.7k 0 02:06 02:02 96 31.41M 96 30.40M 0 0 252.3k 0 02:07 02:03 97 31.41M 97 30.48M 0 0 250.6k 0 02:08 02:04 97 31.41M 97 30.55M 0 0 248.8k 0 02:09 02:05 97 31.41M 97 30.55M 0 0 246.8k 0 02:10 02:06 97 31.41M 97 30.72M 0 0 246.3k 0 02:10 02:07 97 31.41M 97 30.72M 0 0 244.3k 0 02:11 02:08 98 31.41M 98 30.89M 0 0 243.1k 0 02:12 02:10 98 31.41M 98 30.93M 0 0 241.5k 0 02:13 02:11 98 31.41M 98 31.03M 0 0 240.1k 0 02:13 02:12 99 31.41M 99 31.10M 0 0 238.4k 0 02:14 02:13 99 31.41M 99 31.21M 0 0 237.2k 0 02:15 02:14 99 31.41M 99 31.31M 0 0 235.7k 0 02:16 02:15 99 31.41M 99 31.38M 0 0 234.3k 0 02:17 02:17100 31.41M 100 31.41M 0 0 234.1k 0 02:17 02:17100 31.41M 100 31.41M 0 0 234.1k 0 02:17 02:17100 31.41M 100 31.41M 0 0 234.1k 0 02:17 02:17 78495
> tar -xzf pkg.tgz package/dist package/package.json
Copying frontend dist: /tmp/openlist-frontend-npm-WXMmDl/package/dist -> /home/alex/tech/OpenList-Worker/dist
Copied static/manifest.json -> manifest.json (frontend #162)
Stamped frontend-version 4.2.8 into dist/index.html
Patched manifest link with crossorigin=use-credentials in dist/index.html
✓ Frontend dist ready (/home/alex/tech/OpenList-Worker/dist)
[部署] 正在部署到 Cloudflare Workers ...
$ npx wrangler deploy
npm warn Unknown project config "node-linker". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
npm warn Unknown project config "shamefully-hoist". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
npm notice run [email protected] npx
npm notice run 'wrangler' deploy
▲ [WARNING] Proxy environment variables detected. We'll use your proxy for fetch requests.
⛅ wrangler 4.118.0
────────────────────
✘ [ERROR] Build failed with 8 errors:
✘ [ERROR] Could not
resolve "safer-buffer"
node_modules/iconv-lite/encodings/dbcs-codec.js:2:21:
2 │ var Buffer =
require("safer-buffer").Buffer
╵ ~~~~~~~~~~~~~~
To fix this, you can add an entry to "alias" in your
Wrangler configuration.
For more guidance see:
https://developers.cloudflare.com/workers/wrangler/configuration/#bundling-issues
✘ [ERROR] Could not
resolve "safer-buffer"
node_modules/iconv-lite/encodings/internal.js:2:21:
2 │ var Buffer =
require("safer-buffer").Buffer
╵ ~~~~~~~~~~~~~~
To fix this, you can add an entry to "alias" in your
Wrangler configuration.
For more guidance see:
https://developers.cloudflare.com/workers/wrangler/configuration/#bundling-issues
✘ [ERROR] Could not
resolve "safer-buffer"
node_modules/iconv-lite/encodings/sbcs-codec.js:2:21:
2 │ var Buffer =
require("safer-buffer").Buffer
╵ ~~~~~~~~~~~~~~
To fix this, you can add an entry to "alias" in your
Wrangler configuration.
For more guidance see:
https://developers.cloudflare.com/workers/wrangler/configuration/#bundling-issues
✘ [ERROR] Could not
resolve "safer-buffer"
node_modules/iconv-lite/encodings/utf16.js:2:21:
2 │ var Buffer =
require("safer-buffer").Buffer
╵ ~~~~~~~~~~~~~~
To fix this, you can add an entry to "alias" in your
Wrangler configuration.
For more guidance see:
https://developers.cloudflare.com/workers/wrangler/configuration/#bundling-issues
✘ [ERROR] Could not
resolve "safer-buffer"
node_modules/iconv-lite/encodings/utf32.js:3:21:
3 │ var Buffer =
require("safer-buffer").Buffer
╵ ~~~~~~~~~~~~~~
To fix this, you can add an entry to "alias" in your
Wrangler configuration.
For more guidance see:
https://developers.cloudflare.com/workers/wrangler/configuration/#bundling-issues
✘ [ERROR] Could not
resolve "safer-buffer"
node_modules/iconv-lite/encodings/utf7.js:2:21:
2 │ var Buffer =
require("safer-buffer").Buffer
╵ ~~~~~~~~~~~~~~
To fix this, you can add an entry to "alias" in your
Wrangler configuration.
For more guidance see:
https://developers.cloudflare.com/workers/wrangler/configuration/#bundling-issues
✘ [ERROR] Could not
resolve "safer-buffer"
node_modules/iconv-lite/lib/index.js:3:21:
3 │ var Buffer =
require("safer-buffer").Buffer
╵ ~~~~~~~~~~~~~~
To fix this, you can add an entry to "alias" in your
Wrangler configuration.
For more guidance see:
https://developers.cloudflare.com/workers/wrangler/configuration/#bundling-issues
✘ [ERROR] Could not
resolve "safer-buffer"
node_modules/iconv-lite/lib/streams.js:3:21:
3 │ var Buffer =
require("safer-buffer").Buffer
╵ ~~~~~~~~~~~~~~
To fix this, you can add an entry to "alias" in your
Wrangler configuration.
For more guidance see:
https://developers.cloudflare.com/workers/wrangler/configuration/#bundling-issues
🪵 Logs were written to "/home/alex/.config/.wrangler/logs/wrangler-2026-10-24_13-38-43_541.log"
node:internal/errors:999
const err = new Error(message);
^
Error: Command failed: npx wrangler deploy
at genericNodeError (node:internal/errors:999:15)
at wrappedFn (node:internal/errors:544:14)
at checkExecSyncError (node:child_process:990:11)
at execSync (node:child_process:1062:15)
at run (file:///home/alex/tech/OpenList-Worker/scripts/deploy.js:58:12)
at main (file:///home/alex/tech/OpenList-Worker/scripts/deploy.js:85:3)
at file:///home/alex/tech/OpenList-Worker/scripts/deploy.js:98:1
at ModuleJob.run (node:internal/modules/esm/module_job:569:25)
at async node:internal/modules/esm/loader:650:26
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:105:5) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 316201,
stdout: null,
stderr: null
}
Node.js v26.12.1
[ELIFECYCLE] Command failed with exit code 1.
Relevant Configuration (required)
Note: I have not yet configured the account/project IDs, but the build fails before reaching that stage. The following
wrangler.jsoncis generated bygrep -v '^\s*//' wrangler.jsonc | grep -v '^\s*$'.
{
"name": "openlist-tsworkers",
"main": "src/backend/worker.ts",
"compatibility_date": "2026-08-04",
"compatibility_flags": ["nodejs_compat"],
"workers_dev": false,
"preview_urls": false,
"assets": {
"directory": "./dist",
"binding": "ASSETS",
"run_worker_first": ["/", "/index.html"]
},
"vars": {
"ENVIRONMENT": "production",
"DB_FORMAT": "map",
"DB_DRIVER": "auto",
"DB_CIPHER": "none",
"CACHE_ENABLED": "true",
"CACHE_DRIVER": "db",
"CACHE_FILE_TREE": "true",
"CACHE_DOWNLOAD_LINK": "false",
"CACHE_TTL": "0",
"CACHE_LINK_TTL": "5",
"CACHE_EXCLUDE_DRIVERS": "virtual,alias,url_tree,strm,chunk",
"SINGLEFLIGHT": "auto",
},
}
Reproduction Link (optional)
No response
- 主要语言
- TypeScript
- 星标
- 710
- 派生
- 1.3k
- 平均合并
- 2 天 6 小时
- 30 天内合并 PR
- 20
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
OpenListTeam/OpenList-Worker 的其他 Issue
-
bug
难度 4/5 3-5 天 新手友好度 47/100
OpenListTeam/OpenList-Worker#175 ·
维护者通常 1 天内回复
-
bug enhancement
难度 4/5 3-5 天 新手友好度 48/100
OpenListTeam/OpenList-Worker#174 · 4 条评论 ·
维护者通常 1 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 18/100
OpenListTeam/OpenList-Worker#170 · 1 条评论 ·
维护者通常 1 天内回复
-
[BUG] 离线下载报错未关闭bug invalid
难度 4/5 3-5 天 新手友好度 20/100
OpenListTeam/OpenList-Worker#168 · 1 条评论 ·
维护者通常 1 天内回复
-
[BUG] 文件排序问题未关闭bug wontfix
难度 2/5 1-3 小时 新手友好度 50/100
OpenListTeam/OpenList-Worker#167 · 1 条评论 ·
维护者通常 1 天内回复
查看 OpenListTeam/OpenList-Worker 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 73/100
hugomrdias/playwright-test#753 ·
维护者通常 1 天内回复
-
Review view: Daily/Weekly Review header buttons use the app-wide toolbar control style可能已有人在做 @colherdesopa 今天认领。 未关闭
难度 1/5 1-3 小时 新手友好度 90/100
dongdongbh/Mindwtr#1515 ·
维护者通常 1 天内回复
-
pending-triage
难度 2/5 1-3 小时 新手友好度 70/100
kirodotdev/Kiro#12301 ·
-
难度 2/5 1-3 小时 新手友好度 83/100