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

[Bug]: Library scan failing #2854

Closed
decoherencer opened this issue Apr 16, 2024 · 6 comments
Closed

[Bug]: Library scan failing #2854

decoherencer opened this issue Apr 16, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@decoherencer
Copy link

decoherencer commented Apr 16, 2024

Describe the issue

While trying to click on "scan" button in libraries, the new books are not being scanned, the server disconnects for a second and reconnects and is stuck in scanning loop.

the log:

[Server] Unhandled rejection: ReferenceError: structuredClone is not defined, promise: Promise { <rejected> ReferenceError: structuredClone is not defined at LibraryItemScanData.checkLibraryItemData (/snapshot/audiobookshelf-git/server/scanner/LibraryItemScanData.js) at LibraryScanner.scanLibrary (/snapshot/audiobookshelf-git/server/scanner/LibraryScanner.js) at async LibraryScanner.scan (/snapshot/audiobookshelf-git/server/scanner/LibraryScanner.js) at async ApiRouter.scan (/snapshot/audiobookshelf-git/server/controllers/LibraryController.js) }

System: Arch Linux
Package: audiobookshelf-git-v2.8.1.r89.g0f7c99d9-1

Steps to reproduce the issue

  1. add new books to library folder
  2. click on "scan" button in library

Audiobookshelf version

v2.8.1

How are you running audiobookshelf?

Built from source of latest git commit

@decoherencer decoherencer added the bug Something isn't working label Apr 16, 2024
@decoherencer decoherencer changed the title [Bug]: [Bug]: Library scan failing Apr 16, 2024
@nichwall
Copy link
Contributor

Latest git commit being 0f7c99d

@advplyr
Copy link
Owner

advplyr commented Apr 16, 2024

This is likely because you are using node 16 or below. structuredClone was added in node 17 I believe. We are now using node 20 so upgrade to node 20 and you should be good to go.

@advplyr advplyr closed this as not planned Won't fix, can't repro, duplicate, stale Apr 16, 2024
@decoherencer
Copy link
Author

decoherencer commented Apr 17, 2024

Thanks @nichwall i force refreshed git repo, it's building v2.8.1.r90.gf0caf1a9-1 now

@advplyr Sorry, I thought the same, but I only have the node version of v21.7.2 in the system, and it is building with it.

$ where node
/usr/bin/node
$ node -v
v21.7.2

could you please keep it open until we find solution? 😅

@decoherencer
Copy link
Author

decoherencer commented Apr 17, 2024

I tried makepkg --cleanbuild too
it seems in recent pull by @mikiher #2773 server/scanner/LibraryItemScanData.js is updated to add this structuredClone part, so I am not sure if change has to be looked at again 🤔

@mikiher
Copy link
Contributor

mikiher commented Apr 17, 2024

Try adding the following line in the init() function in server/server.js:
Logger.info('[Server] node version:', process.versions.node)

Then run the server and see what version is printed. @advplyr's comment is very likely the issue you're facing.

@decoherencer
Copy link
Author

Thanks @mikiher
Upon tinkering further ( I am new to nodejs), I found the culprit line in aur pkgbuild
"${srcdir}/${pkgname}"/node_modules/.bin/pkg -t node16-linux -o "${pkgdir}/usr/bin/audiobookshelf"

Also, the pkg repo is archived and doesn't support the latest node. So I changed it to the node18-linux target, which works now. It would be helpful if you could suggest something replacement for pkg in the above line to target the latest node versions in future, like in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants