Weird syntaxError after electron app packaging: 意外的标记 (

huangapple go评论49阅读模式
英文:

Weird syntaxError after electron app packaging : Unexpected token (

问题

我目前正在尝试第一次为我的Electron应用打包,并且遇到了一个奇怪的错误。

在启动app.exe时,出现了以下错误消息:

> 未捕获的异常:
> C:\ .... \build\main.js:39
> electron_1.app.on("ready", async () => {
>
> SyntaxError: 意外的标记 (
> 在 Object.export.runInThisContext (vm.js:76:16) 处
> 在 ...

箭头指向在 app.on 后的括号。

该应用是使用tsc从typescript编译为js(我想这不会影响最终结果),然后使用以下命令打包的:

electron-packager . testApp --platform=win32 --arch=x64 --electron-version=1.4.3

如果能提供帮助,我将不胜感激,因为我真的被这个错误搞得一头雾水。

英文:

I am currently trying to package my electron app for the first time, and I am encountering a weird bug.

When launching the app.exe, this error message appears :

> Uncaught Exception:
> C:\ .... \build\main.js:39
> electron_1.app.on("ready", async () => {
>
> SyntaxError: Unexpected token (
> at Object.export.runInThisContext (vm.js:76:16)
> at ...

The arrow points at the parenthesis right after app.on.

The app is compiled from typescript to js with tsc (not that this would affect the final result I suppose), then packed with

electron-packager . testApp --platform=win32 --arch=x64 --electron-version=1.4.3

Any help would be appreciated, as I am really stumped by this error.

答案1

得分: 1

好的,以下是翻译好的部分:

"Ok, so turns out the command I was using to package the app was specifying an electron version (unnecessary) different from the one I used. Removing the specific version from the command line fixed it."

英文:

Ok, so turns out the command I was using to package the app was specifying an electron version (unnecessary) different from the one I used. Removing the specific version from the command line fixed it.

huangapple
  • 本文由 发表于 2023年2月19日 01:19:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/75495049.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定