SyntaxError: Unexpected token function
TheLastZombie opened this issue · 6 comments
I'm probably missing something here, but I just can't figure out what it is.
Spoticord errors immediately upon startup.
┌───────────┬────┬──────┬─────┬─────────┬─────────┬────────┬─────┬────────┬──────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
├───────────┼────┼──────┼─────┼─────────┼─────────┼────────┼─────┼────────┼──────┼──────────┤
│ spoticord │ 0 │ fork │ 0 │ errored │ 31 │ 0 │ 0% │ 0 B │ Eric │ disabled │
└───────────┴────┴──────┴─────┴─────────┴─────────┴────────┴─────┴────────┴──────┴──────────┘
This is pm2's error log.
C:\Program Files\spoticord\app.js:30
async function spotifyReconnect () {
^^^^^^^^
SyntaxError: Unexpected token function
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Object.<anonymous> (C:\Users\Eric\AppData\Roaming\npm\node_modules\pm2\lib\ProcessContainerFork.js:78:21)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
Same promblem...
Exact same problem here.
If you find a workaround, please contact me.
Make sure you're using the latest version of Node for async to work correctly.
lmao, for some reason I was still running 6.10.0
so updating fixed that, but it still errors using 8.9.3:
new error log:
C:\Program Files\spoticord\app.js:30
async function spotifyReconnect () {
^^^^^^^^
SyntaxError: Unexpected token function
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Object.<anonymous> (C:\Users\Eric\AppData\Roaming\npm\node_modules\pm2\lib\ProcessContainerFork.js:78:21)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
so I guess I'm facing #54 now.
edit: doesn't work using 9.3.0 either.
Update: It works! After a lot of searching and trial and error, I found out that something with the setup went wrong and Python was not found on my machine (although I have it installed in the exact path the setup was looking in).
To fix this, simply run the following command with administrative rights after installing Node.js but before setting up spoticord:
npm install -g npm windows-build-tools register-scheme bufferutil erlpack node-opus opusscript sodium libsodium-wrappers uws zlib-sync eslint
npm install -g npm
makes sure the latest version is installed.
npm install -g windows-build-tools
fixes the Python error.
The rest are dependencies required by spoticord.
I did a lot of experimenting so sorry if this command doesn't work, just reply and I'll try to do my best to help you!
Edit: If the installation of sodium gives you a timeout error, just ignore it and run npm install -g npm windows-build-tools register-scheme bufferutil erlpack node-opus opusscript libsodium-wrappers uws zlib-sync eslint
instead (same command, without sodium).