use*_*828 5 node.js electron asar
我目前正在开发一个电子应用程序,在某些时候可以将 HTML 文件转换为 PDF 文件。为此,我使用html-pdf基于phantomjs.
当应用程序未打包但在asar下时,它运行良好,由于无法生成子进程,因此存在未捕获的异常html-pdf。
堆栈错误
internal/child_process.js:302 Uncaught Error: spawn ENOTDIR
exports._errnoException @ util.js:890
ChildProcess.spawn @ internal/child_process.js:302
exports.spawn @ child_process.js:379
PdfExec @ /Users/graphfx/html2pdf/html2pdf.asar/node_modules/html-pdf/lib/…:87
PdfToFile @ /Users/graphfx/html2pdf/html2pdf.asar/node_modules/html-pdf/lib/…:83
convert @ index.html:35
onclick @ index.html:19
Run Code Online (Sandbox Code Playgroud)
我想这是由于Node API 上的asar 限制,但由于Windows 上的260 个字符路径长度限制,我真的需要将我的应用程序打包在asar 中。
我--unpack-dir 'node_modules'在构建asar包时也尝试使用该选项 ,但问题仍然存在。
重现错误
git clone https://github.com/Graphfx/html2pdf
cd html2pdf
npm install
npm run asar-pack
npm run start-asar
Run Code Online (Sandbox Code Playgroud)
有人知道如何解决这个问题吗?
| 归档时间: |
|
| 查看次数: |
1012 次 |
| 最近记录: |