闲来无事,突然对前端开发桌面应用程序感兴趣,就开始学习electron
打开electron的官网教程一步步学习,顺畅无比,连错误都没有遇到,信心倍增啊!
终于来到了打包环节,可以实现自己的第一个可执行文件 啦,能不开心吗?哈哈,果然程序员终究不可能太顺利,就开始报错啦!运行yarn make后报了以下错误。
✖ Making for target: squirrel - On platform: win32 - For arch: x64
An unhandled error has occurred inside Forge:
An error occured while making for target: squirrel
Failed with exit code: 1
Output:
���ڳ��Դӡ�new_electron_student.nuspec�����ɳ������
Authors is required.
Description is required.
Error: Failed with exit code: 1
Output:
Authors is required.
Description is required.
at ChildProcess.<anonymous> (D:\前端代码\Electron学习\new-electron-student\node_modules\electron-winstaller\lib\spawn-promise.js:49:24)
at ChildProcess.emit (node:events:390:28)
at ChildProcess.emit (node:domain:475:12)
at maybeClose (node:internal/child_process:1064:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
错误里面说,Authors和Description是必须的,但这个是什么,我不清楚。
因此,开启了盲目度娘环节,找了许久,终于看到相关错误文章,帮忙解决了问题。
引起错误的原因:
我项目初始化采用了
yarn init -y
所以description和author是一个空字符串,所以我们只需将这两个字段的值不要是空字符即可。
到这里错误解决,运行yarn make 后,在out\make\squirrel.windows\x64目录下,看到了可执行文件😁。
此次错误值得记录,向前端出发,做秃头程序员。
感谢以下博主的文章,让我快速解决了问题。
解决问题的文章来源:https://blog.csdn.net/My__God/article/details/111139222