xemle / home-gallery

Self-hosted open-source web gallery to view your photos and videos featuring mobile-friendly, tagging and AI powered image discovery
https://home-gallery.org
MIT License
836 stars 64 forks source link

Not able to import Pictures - TypeError: log.err is not a function #142

Closed Nemoran closed 5 months ago

Nemoran commented 5 months ago

Hi,

I recently installed HomeGallery as a Test on some old Notebook which was working absolutely fine. (Absolutely love this piece of software, as it is so intuitive and running so smooth!!) Now as I want to use it in production, Installed on some new Hardware, I am not able to import any Pictures after startup:

/app # ./gallery.js 
✔ Gallery main menu · update
✔ Update files · initialSmall
[2024-06-13 08:48:39.655]: cli.task.import Import files from source dirs: /data/Pictures
[2024-06-13 08:48:39.662]: cli.spawn Run cli with index --directory /data/Pictures --index /data/config/Pictures.idx --exclude-if-present .galleryignore
[2024-06-13 08:48:39.844]: index Updating file index for directory /data/Pictures
/app/node_modules/@home-gallery/index/dist/create.js:41
      log.err(`Could not read files in ${dir}: ${err}`);
          ^

TypeError: log.err is not a function
    at /app/node_modules/@home-gallery/index/dist/create.js:41:11
    at /app/node_modules/@home-gallery/index/dist/walker.js:53:18
    at /app/node_modules/@home-gallery/index/dist/walker.js:53:18
    at handleReaddirError (/app/node_modules/@home-gallery/index/dist/walker.js:11:10)
    at /app/node_modules/@home-gallery/index/dist/walker.js:75:14
    at FSReqCallback.oncomplete (node:fs:192:23)

Node.js v18.20.2

Compose File:

version: "3.9"
services:
  api:
    # custom build via
    #build: packages/api-server
    image: xemle/home-gallery-api-server
    environment:
      # TensorflowJS backends
      # - cpu: slowest and best support
      # - wasm: good perfromance for arm64 and amd64 platforms
      # - node: best performance on amd64 platform
      #- BACKEND=cpu
      - BACKEND=wasm
      #- BACKEND=node
  gallery:
    # custom build via
    #build: .
    image: xemle/home-gallery
    environment:
      - GALLERY_API_SERVER=http://api:3000
      #- GALLERY_API_SERVER_CONCURRENT=1 # On low powered devices
      #- GALLERY_API_SERVER_TIMEOUT=60 # On low powered devices
      - GALLERY_OPEN_BROWSER=false
      # Use polling for safety of possible network mounts. Try 0 to use inotify via fs.watch
      - GALLERY_WATCH_POLL_INTERVAL=300
    volumes:
      - D:\Docker\HomeGallery\data:/data
      # Mount your media directories below /data
      - D:\Docker\HomeGallery\data\Pictures:/data/Pictures
    ports:
      - "3000:3000"
    user: "${CURRENT_USER}"
    entrypoint: ['node', '/app/gallery.js']
    command: ['run', 'server']

Not quite sure if this is some configuration error or some bug?

Would appreciateany help :) Thank you!

xemle commented 5 months ago

Hi @Nemoran

thank you for the compliment about HomeGallery.

[2024-06-13 08:48:39.844]: index Updating file index for directory /data/Pictures
/app/node_modules/@home-gallery/index/dist/create.js:41
      log.err(`Could not read files in ${dir}: ${err}`);
          ^

TypeError: log.err is not a function

is a overlapping error. The logger call is invalid and should be log.error(...) which I have now fixed.

The reason why this error happens because the directory /data/Pictures is somehow not readable. Your compose file looks OKish with

version: "3.9"
services:
  gallery:
    volumes:
      - D:\Docker\HomeGallery\data:/data
      # Mount your media directories below /data
      - D:\Docker\HomeGallery\data\Pictures:/data/Pictures

However I do not have experience mounting a windows path D:\Docker\HomeGallery\data\Pictures to the docker container path /data/Pictures.

You can try to run

$ docker compose run --entrypoint /bin/sh gallery
~ # ls /data/Pictures/

and you should see your mounted folder inside the container.

Hope that helps

Nemoran commented 5 months ago

Hi @xemle,

thank you for your fast response! With the correct log output, I was able to resolve the issue.

HP Wolf Security creates some hidden "~Bromium" Folders, which can´t be processed within Docker, as there are now permissions. Uninstalling Wolf Security, helped :)

thx, Nemoran