electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.41k stars 505 forks source link

A Very Unhelpful error message #3397

Closed TheManOfficial closed 10 months ago

TheManOfficial commented 10 months ago

Pre-flight checklist

Electron Forge version

9.2.0

Electron version

9.2.0

Operating system

PikaOS 3 (Ubuntu 23.10, Lunar Lobster Based)

Last known working Electron Forge version

9.2.0

Expected behavior

Either an actually descriptive error or it to go on as normal

Actual behavior

Gives me a very unhelpful error and will not continue the build: An unhandled rejection has occurred inside Forge: SyntaxError: Unexpected token ','

Steps to reproduce

It was working just fine yesterday when I made a build, all I've done since then is rebooted my computer and try to build the exact same thing again.

Additional information

Full command run: npm run make forge.config.js: rebuildConfig: {}, makers: [ { name: '@electron-forge/maker-squirrel', config: {}, platforms: ["linux"] }, { name: "@electron-forge/maker-zip", config: {}, platforms: ["linux"] } ], plugins: [ { name: '@electron-forge/plugin-auto-unpack-natives', config: {}, }, ] package.json: { "name": "dodge-the-french", "version": "0.0.1", "author": "The Man Studios", "license": "Restrictive As Fuck", "description": "A game where baguette", "main": "index.js", "scripts": { "start": "electron-forge start", "test": "echo \"Error: no test specified\" && exit 1", "package": "electron-forge package", "make": "electron-forge make" }, "devDependencies": { "@electron-forge/cli": "^6.4.2", "@electron-forge/maker-deb": "^6.4.2", "@electron-forge/maker-rpm": "^6.4.2", "@electron-forge/maker-squirrel": "^6.4.2", "@electron-forge/maker-zip": "^6.4.2", "@electron-forge/plugin-auto-unpack-natives": "^6.4.2", "electron": "^26.2.0", "electron-installer-debian": "^3.0.0" }, "dependencies": { "electron-squirrel-startup": "^1.0.0" }, "icon": { "iconPath": { "win": "icons/icon.ico", "linux": "icons/icon.png" } } }

I cannot spot any errors in either of those files, even after looking at them for a while.

erikian commented 10 months ago

Do you have a full stack trace?

TheManOfficial commented 10 months ago

Do you have a full stack trace?

If you mean by using --verbose on the npm flags then yes: 0 verbose cli /usr/bin/node /usr/bin/npm 1 info using npm@9.2.0 2 info using node@v18.13.0 3 timing npm:load:whichnode Completed in 0ms 4 timing config:load:defaults Completed in 1ms 5 timing config:load:file:/usr/share/nodejs/npm/npmrc Completed in 2ms 6 timing config:load:builtin Completed in 2ms 7 timing config:load:cli Completed in 2ms 8 timing config:load:env Completed in 0ms 9 timing config:load:file:/home/false/DTF/.npmrc Completed in 0ms 10 timing config:load:project Completed in 0ms 11 timing config:load:file:/home/false/.npmrc Completed in 0ms 12 timing config:load:user Completed in 1ms 13 timing config:load:file:/etc/npmrc Completed in 0ms 14 timing config:load:global Completed in 0ms 15 timing config:load:setEnvs Completed in 0ms 16 timing config:load Completed in 8ms 17 timing npm:load:configload Completed in 8ms 18 timing npm:load:mkdirpcache Completed in 0ms 19 timing npm:load:mkdirplogs Completed in 0ms 20 verbose title npm run electron 21 verbose argv "run" "electron" "--version" 22 timing npm:load:setTitle Completed in 1ms 23 timing config:load:flatten Completed in 2ms 24 timing npm:load:display Completed in 3ms 25 verbose logfile logs-max:10 dir:/home/false/.npm/_logs/2023-11-02T05_39_32_079Z- 26 verbose logfile /home/false/.npm/_logs/2023-11-02T05_39_32_079Z-debug-0.log 27 timing npm:load:logFile Completed in 4ms 28 timing npm:load:timers Completed in 0ms 29 timing npm:load:configScope Completed in 0ms 30 timing npm:load Completed in 17ms 31 verbose exit 0 32 timing npm Completed in 22ms 33 info ok

erikian commented 10 months ago

No, I mean the rest of the text close to where you're getting SyntaxError: Unexpected token ','.

TheManOfficial commented 10 months ago

Here: $ npm run make

dodge-the-french@0.0.1 make electron-forge make

✔ Checking your system ⠋ Loading configuration ✖ Loading configuration › Unexpected token ',' ◼ Resolving make targets ◼ Running package command ◼ Running preMake hook ◼ Making distributables ◼ Running postMake hook

An unhandled rejection has occurred inside Forge: SyntaxError: Unexpected token ','

erikian commented 10 months ago

That's a syntax error in your forge.config.js file. The error message is a default JS error message, so it's not related to Forge in any way. I'd create a blank forge.config.js and start moving your configuration over a few lines at a time, this makes it easier to spot the error (and sometimes you just end up fixing the error without even noticing).