Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Unexpected token function #50

Closed
TheLastZombie opened this issue Dec 17, 2017 · 6 comments
Closed

SyntaxError: Unexpected token function #50

TheLastZombie opened this issue Dec 17, 2017 · 6 comments

Comments

@TheLastZombie
Copy link

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)
@estevE11
Copy link

Same promblem...

@ProDjMx
Copy link

ProDjMx commented Dec 22, 2017

Exact same problem here.
If you find a workaround, please contact me.

@exe
Copy link

exe commented Dec 23, 2017

Make sure you're using the latest version of Node for async to work correctly.

@ProDjMx
Copy link

ProDjMx commented Dec 23, 2017

@HRVYx Yep, because of the problem I reinstalled it and it didn't fix it.

@TheLastZombie
Copy link
Author

TheLastZombie commented Dec 23, 2017

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.

@TheLastZombie
Copy link
Author

TheLastZombie commented Jan 7, 2018

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants