PerryTs初探(三): 结合node模块开发
2026-05-29
1.先说总结
失败了, 这里记录下过程
2. 过程
使用win11进行开发的环境, 用npm加载了处理excel的模块, 按照官方给的编译指令没有编译成功
编译指令
perry compile main.ts --enable-js-runtime
报错:
1 Collecting modules... 2 JS runtime: ALLOWED (perry.allowJsRuntime: true) 3 JS module: xlsx -> \\?\D:\code\zb\perry\testexcel\src\node_modules\xlsx\xlsx.mjs 4 JS module: xlsx -> \\?\D:\code\zb\perry\testexcel\src\node_modules\xlsx\xlsx.mjs 5 Found 3 module(s): 2 native, 1 JavaScript 6 Generating code... 7 Wrote object file: main_ts.o 8 Wrote object file: utils_zbperryui_ts.o 9 Generated JS bundle: .\__perry_js_bundle.js 10 warning: failed to embed JS bundle into binary (Failed to invoke cc for embedded JS bundle: program not found); the resulting binary will still require node_modules/ at runtime 11 Linking (runtime-only)... 12 13 14 Error: JavaScript modules found but libperry_jsruntime.a not found. Build it with: cargo build --release -p perry-jsruntime
意思是要先用rust构建源码, 然后生成 perry-jsruntime: 官方文档Building from Source - Perry Documentation
从gitee上下载了别人同步的源码, 编译的时候又出了问题, 关键的v8引擎构建失败, 应该是下载什么东西的时候下载不了了(估计是连不上github吧)
1 warning: `perry` (bin "perry") generated 41 warnings (run `cargo fix --bin "perry" -p perry` to apply 1 suggestion) 2 warning: `perry-ext-fetch` (lib) generated 2 warnings 3 Building [=======================> ] 972/977: v8(build)
停在这里了
完了, 不想再搞下去了, 我用python原生的UI也挺好......
卸载,退圈....

浙公网安备 33010602011771号