yasinatesim / facebook-album-downloader

This project is s simple web application that allows users to download Facebook albums in full resolution
MIT License
14 stars 5 forks source link

Failure to download #3

Open hloukas opened 1 year ago

hloukas commented 1 year ago

Hi! I followed the installation instructions and after I successfully opened a client I tried to download an album. However the client failed to do so with the following error message:

app_1 | error - Error: Failed to launch the browser process! spawn /root/.cache/puppeteer/chrome/linux-1108766/chrome-linux/chrome ENOENT

I have verified that the chrome path is valid, however one can only access it as a sudoer. For regular users the access to the .cache folder is denied. So I am guessing that is the problem.

I set the docker container as privileged by adding the appropriate parameter in the docker compose file and I also tried running yarn setup as sudo but it does not work.

Any ideas on how to overcome this?

yasinatesim commented 1 year ago

Hey @traba-cool-ass 👋 Can you please try

  1. Remove docker-compose.yaml in the project root.
  2. Replacing the code below with the code in your Dockerfile and run below commands?

Dockerfile

FROM node:14.16.0-buster-slim@sha256:908fe3e2e9196721064e1f1bf001f630ae1d7b2b4bdd65effff9f271711b04bb

RUN  apt-get update \
     && apt-get install -y wget gnupg ca-certificates \
     && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
     && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
     && apt-get update \
     # We install Chrome to get all the OS level dependencies, but Chrome itself
     # is not actually used as it's packaged in the node puppeteer library.
     # Alternatively, we could could include the entire dep list ourselves
     # (https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix)
     # but that seems too easy to get out of date.
     && apt-get install -y google-chrome-stable \
     && rm -rf /var/lib/apt/lists/* \
     && wget --quiet https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -O /usr/sbin/wait-for-it.sh \
     && chmod +x /usr/sbin/wait-for-it.sh \
     && apt-get update \
     && apt-get -qq -y install curl

COPY . /usr/app

RUN  npm install && npm run build

WORKDIR /usr/app
RUN  npm install

EXPOSE 3000

CMD ["npm", "start"]

Command

// For Build
docker build -t facebook-album-downloader .

// For Run
docker run -p 3000:3000 facebook-album-downloader
hloukas commented 1 year ago

I got some warnings and the following error in step 4/8:

Step 4/8 : RUN npm install && npm run build ---> Running in 49981cf4bc6b npm WARN saveError ENOENT: no such file or directory, open '/package.json' npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN enoent ENOENT: no such file or directory, open '/package.json' npm WARN !invalid#2 No description npm WARN !invalid#2 No repository field. npm WARN !invalid#2 No README data npm WARN !invalid#2 No license field.

up to date in 0.438s found 0 vulnerabilities

npm ERR! code ENOENT npm ERR! syscall open npm ERR! path /package.json npm ERR! errno -2 npm ERR! enoent ENOENT: no such file or directory, open '/package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2023-10-27T19_56_37_467Z-debug.log The command '/bin/sh -c npm install && npm run build' returned a non-zero code: 254

Trying to solve it now, I will let you know if I solve it.

I think the issue is that for some reason npm is looking for /package.json, when package.json in the current folder so it should be ./package.json

yasinatesim commented 1 year ago

Hey @traba-cool-ass, sorry this is my fault, I wrote npm install twice above file.

Please remove your docker build and image after that try this;

FROM node:14.16.0-buster-slim@sha256:908fe3e2e9196721064e1f1bf001f630ae1d7b2b4bdd65effff9f271711b04bb

RUN  apt-get update \
     && apt-get install -y wget gnupg ca-certificates \
     && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
     && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
     && apt-get update \
     # We install Chrome to get all the OS level dependencies, but Chrome itself
     # is not actually used as it's packaged in the node puppeteer library.
     # Alternatively, we could could include the entire dep list ourselves
     # (https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix)
     # but that seems too easy to get out of date.
     && apt-get install -y google-chrome-stable \
     && rm -rf /var/lib/apt/lists/* \
     && wget --quiet https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -O /usr/sbin/wait-for-it.sh \
     && chmod +x /usr/sbin/wait-for-it.sh \
     && apt-get update \
     && apt-get -qq -y install curl

COPY . /usr/app

COPY package.json /usr/app

WORKDIR /usr/app

EXPOSE 3000

CMD ["npm", "run", "dev"]
hloukas commented 1 year ago

Ok, I can see some progress now. The

docker build -t facebook-album-downloader .

command finishes successfully and builds the image but when I try to run it I get the following error:

next-starter-kit@3.0.0 dev /usr/app next dev

sh: 1: next: not found npm ERR! code ELIFECYCLE npm ERR! syscall spawn npm ERR! file sh npm ERR! errno ENOENT npm ERR! next-starter-kit@3.0.0 dev: next dev npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the next-starter-kit@3.0.0 dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2023-10-30T17_31_42_862Z-debug.log

I have run yarn install before doing all of this and I also tried running npm install with no results.

yasinatesim commented 1 year ago

@traba-cool-ass, sorry for late response. I've been working on it for a while and finally solved it 😁 Can you please run

git pull origin master

I fixed the problem and committed it on master branch. Please check the commit and new README 👇 https://github.com/yasinatesim/facebook-album-downloader/commit/0a57796c2a9462e1f82268fbbaeb67e78de3819b

  1. Rename .env.example to .env
  2. Run docker build -t facebook-album-downloader .
hloukas commented 12 months ago

Hello again! No worries, took me a while to respond as well.

I no longer have any errors while building or running, however the .zip file that is downloaded is empty. Could it be that I am providing a wrong link?

In the terminal it says that it found a total of 0 photos.

yasinatesim commented 12 months ago

Hey @traba-cool-ass, ok thank you 🙂

Can you please check https://github.com/yasinatesim/facebook-album-downloader/issues/2. Sometimes there are problems with some links, but I can't catch it 🙁 Please watch the video in the issue (https://github.com/yasinatesim/facebook-album-downloader/issues/2). The same link works to me in the issue. I don't know that the problem. I need to be able to catch the problem to be able to help