lukeliasi / binance-dca-bot

A bot to automatically DCA (Dollar-Cost Average) buy cryptocurrency on Binance
MIT License
183 stars 51 forks source link

Unexpected reserved word in 'await' runBot() in index.js #6

Closed lcvalves closed 3 years ago

lcvalves commented 3 years ago

Hi! I was trying to deploy this bot on a Vultr Ubuntu 21.04 VPS but got the following error when executing sudo npm run start.

However, I tried running the bot on a Windows 10 system and it seemed to work fine but I really wanted to test this out on a Ubuntu VPS.

My index.js file is as presented in the repo.

Terminal output:

lcvalves@vultr:~/binance-dca-bot$ npm run start `> binance-dca-bot@1.0.0 start` `> node ./src/index.js` file:///home/lcvalves/binance-dca-bot/src/index.js:59 await runBot(); ^^^^^

SyntaxError: Unexpected reserved word at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18) at async link (internal/modules/esm/module_job.js:42:21) npm ERR! code 1 npm ERR! path /home/lcvalves/binance-dca-bot npm ERR! command failed npm ERR! command sh -c node ./src/index.js

npm ERR! A complete log of this run can be found in: npm ERR! /home/lcvalves/.npm/_logs/2021-05-23T21_13_07_258Z-debug.log

Log:

0 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'start' ] 1 info using npm@7.5.2 2 info using node@v12.21.0 3 timing config:load:defaults Completed in 1ms 4 timing config:load:file:/usr/share/nodejs/npm/npmrc Completed in 2ms 5 timing config:load:builtin Completed in 2ms 6 timing config:load:cli Completed in 1ms 7 timing config:load:env Completed in 1ms 8 timing config:load:file:/home/lcvalves/binance-dca-bot/.npmrc Completed in 0ms 9 timing config:load:project Completed in 1ms 10 timing config:load:file:/home/lcvalves/.npmrc Completed in 0ms 11 timing config:load:user Completed in 0ms 12 timing config:load:file:/etc/npmrc Completed in 0ms 13 timing config:load:global Completed in 0ms 14 timing config:load:cafile Completed in 0ms 15 timing config:load:validate Completed in 1ms 16 timing config:load:setUserAgent Completed in 0ms 17 timing config:load:setEnvs Completed in 1ms 18 timing config:load Completed in 9ms 19 verbose npm-session 2578695e0cfbb54c 20 timing npm:load Completed in 19ms 21 timing command:run-script Completed in 115ms 22 verbose stack Error: command failed 22 verbose stack at ChildProcess.<anonymous> (/usr/share/nodejs/@npmcli/promise-spawn/index.js:64:27) 22 verbose stack at ChildProcess.emit (events.js:314:20) 22 verbose stack at maybeClose (internal/child_process.js:1022:16) 22 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) 23 verbose pkgid binance-dca-bot@1.0.0 24 verbose cwd /home/lcvalves/binance-dca-bot 25 verbose Linux 5.11.0-16-generic 26 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "start" 27 verbose node v12.21.0 28 verbose npm v7.5.2 29 error code 1 30 error path /home/lcvalves/binance-dca-bot 31 error command failed 32 error command sh -c node ./src/index.js 33 verbose exit 1

Any clues on how to fix this?

lukeliasi commented 3 years ago

I see from the logs you are using node v12, please upgrade the version, Node 13+ is required to run the bot

lcvalves commented 3 years ago

Completely forgot about that requirement. Issue fixed. Thanks!