carcabot / tiktok-signature

Generate tiktok signature token using node
756 stars 286 forks source link

Problem running node server.js on a Raspberry Pi 3 B+ #27

Closed robindz closed 4 years ago

robindz commented 4 years ago

After updating and installing node:

pi@chaengpi:~/scripts/tiktok-signature $ node -v
v10.19.0

I run into a problem when I try running the server.js script.

pi@chaengpi:~/scripts/tiktok-signature $ node server.js 
/home/pi/scripts/tiktok-signature/index.js:9
  userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36";
            ^

SyntaxError: Unexpected token =
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/pi/scripts/tiktok-signature/server.js:1:16)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

I'm not getting much wiser from this error, do you perhaps know why it's causing this issue?

carcabot commented 4 years ago

Hi,

Please check this comment

robindz commented 4 years ago

@carcabot

Ok that solved that issue, but a new one has risen. So, after installing node to v13.11.0 and installing puppeteer with npm i puppeteer puppeteer-extra puppeteer-extra-plugin-stealth I know get this error:

pi@chaengpi:~/scripts/tiktok-signature $ node server.js 
Error: Failed to launch the browser process!
/home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 1: /home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: �: not found
/home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 1: /home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: ELF: not found
/home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 2: /home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: p#: not found
/home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 3: /home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: p#: not found
/home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 4: /home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: @l�: not found
/home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 5: /home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: pX: not found
/home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 6: /home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: /home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 4: /home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: pX: not found
��q: not found
/home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 7: /home/pi/scripts/tiktok-signature/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: Syntax error: "(" unexpected

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md

    at onClose (/home/pi/scripts/tiktok-signature/node_modules/puppeteer/lib/Launcher.js:750:14)
    at Interface.<anonymous> (/home/pi/scripts/tiktok-signature/node_modules/puppeteer/lib/Launcher.js:739:50)
    at Interface.emit (events.js:327:22)
    at Interface.close (readline.js:424:8)
    at Socket.onend (readline.js:202:10)
    at Socket.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1201:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
carcabot commented 4 years ago

I'm not sure if puppeteer is supported by linux arm versions.

Possible answer you can find here or here

robindz commented 4 years ago

@carcabot

Ok, I solved this by doing the following:

  1. uninstalled chromium-browser that came installed with puppeteer (I suspected it might have grabbed a bad version)
  2. sudo apt-get install chromium-browser
  3. in index.js, add executablePath: "/usr/bin/chromium-browser" to this.options